Browse Source

* remaining web changes merged. This batch is mostly apache related
--- Merging r23204 into '.':
A packages/httpd24
A packages/httpd24/fpmake.pp
A packages/httpd24/Makefile.fpc
A packages/httpd24/src
A packages/httpd24/src/util_filter.inc
A packages/httpd24/src/httpd.inc
A packages/httpd24/src/httpd24.pas
A packages/httpd24/src/http_config.inc
A packages/httpd24/src/ap_config.inc
A packages/httpd24/src/ap_mmn.inc
A packages/httpd24/src/http_core.inc
A packages/httpd24/src/aprutil
A packages/httpd24/src/aprutil/apr_uri.inc
A packages/httpd24/src/aprutil/apr_buckets.inc
A packages/httpd24/src/ap_regex.inc
A packages/httpd24/src/apr
A packages/httpd24/src/apr/apr_pools.inc
A packages/httpd24/src/apr/apr_time.inc
A packages/httpd24/src/apr/apr_user.inc
A packages/httpd24/src/apr/apr_allocator.inc
A packages/httpd24/src/apr/apr_errno.inc
A packages/httpd24/src/apr/apr_version.inc
A packages/httpd24/src/apr/apr_strings.inc
A packages/httpd24/src/apr/apr.pas
A packages/httpd24/src/apr/apr_file_info.inc
A packages/httpd24/src/apr/apr_mmap.inc
A packages/httpd24/src/apr/apr_tables.inc
A packages/httpd24/src/util_cfgtree.inc
A packages/httpd24/src/ap_expr.inc
A packages/httpd24/src/ap_release.inc
A packages/httpd24/src/http_log.inc
A packages/httpd24/src/http_protocol.inc
A packages/httpd24/Makefile
A packages/httpd24/examples
A packages/httpd24/examples/Makefile
A packages/httpd24/examples/mod_hello.pp
A packages/httpd24/examples/Makefile.fpc
--- Merging r23206 into '.':
U packages/fpmake_proc.inc
U packages/fpmake_add.inc
--- Merging r23207 into '.':
U packages/httpd24/fpmake.pp
A packages/httpd24/src/apr/apr24.pas
D packages/httpd24/src/apr/apr.pas
U packages/httpd24/src/httpd24.pas
--- Merging r23208 into '.':
C packages/fcl-web/src/base/Makefile
U packages/fcl-web/src/base/Makefile.fpc
A packages/fcl-web/src/base/fpapache24.pp
--- Merging r23209 into '.':
U packages/fcl-web/fpmake.pp
--- Merging r23242 into '.':
G packages/fcl-web/fpmake.pp
--- Merging r23244 into '.':
U packages/httpd24/src/apr/apr_mmap.inc
Summary of conflicts:
Text conflicts: 1

# revisions: 23204,23206,23207,23208,23209,23242,23244
r23204 | michael | 2012-12-22 13:41:25 +0100 (Sat, 22 Dec 2012) | 1 line
Changed paths:
A /trunk/packages/httpd24
A /trunk/packages/httpd24/Makefile
A /trunk/packages/httpd24/Makefile.fpc
A /trunk/packages/httpd24/examples
A /trunk/packages/httpd24/examples/Makefile
A /trunk/packages/httpd24/examples/Makefile.fpc
A /trunk/packages/httpd24/examples/mod_hello.pp
A /trunk/packages/httpd24/fpmake.pp
A /trunk/packages/httpd24/src
A /trunk/packages/httpd24/src/ap_config.inc
A /trunk/packages/httpd24/src/ap_expr.inc
A /trunk/packages/httpd24/src/ap_mmn.inc
A /trunk/packages/httpd24/src/ap_regex.inc
A /trunk/packages/httpd24/src/ap_release.inc
A /trunk/packages/httpd24/src/apr
A /trunk/packages/httpd24/src/apr/apr.pas
A /trunk/packages/httpd24/src/apr/apr_allocator.inc
A /trunk/packages/httpd24/src/apr/apr_errno.inc
A /trunk/packages/httpd24/src/apr/apr_file_info.inc
A /trunk/packages/httpd24/src/apr/apr_mmap.inc
A /trunk/packages/httpd24/src/apr/apr_pools.inc
A /trunk/packages/httpd24/src/apr/apr_strings.inc
A /trunk/packages/httpd24/src/apr/apr_tables.inc
A /trunk/packages/httpd24/src/apr/apr_time.inc
A /trunk/packages/httpd24/src/apr/apr_user.inc
A /trunk/packages/httpd24/src/apr/apr_version.inc
A /trunk/packages/httpd24/src/aprutil
A /trunk/packages/httpd24/src/aprutil/apr_buckets.inc
A /trunk/packages/httpd24/src/aprutil/apr_uri.inc
A /trunk/packages/httpd24/src/http_config.inc
A /trunk/packages/httpd24/src/http_core.inc
A /trunk/packages/httpd24/src/http_log.inc
A /trunk/packages/httpd24/src/http_protocol.inc
A /trunk/packages/httpd24/src/httpd.inc
A /trunk/packages/httpd24/src/httpd24.pas
A /trunk/packages/httpd24/src/util_cfgtree.inc
A /trunk/packages/httpd24/src/util_filter.inc

* httpd 2.4 (Apache 2.4) headers by A. Borka
r23206 | michael | 2012-12-22 17:31:41 +0100 (Sat, 22 Dec 2012) | 1 line
Changed paths:
M /trunk/packages/fpmake_add.inc
M /trunk/packages/fpmake_proc.inc

* Also compile httpd24
r23207 | michael | 2012-12-22 17:36:43 +0100 (Sat, 22 Dec 2012) | 1 line
Changed paths:
M /trunk/packages/httpd24/fpmake.pp
D /trunk/packages/httpd24/src/apr/apr.pas
A /trunk/packages/httpd24/src/apr/apr24.pas (from /trunk/packages/httpd24/src/apr/apr.pas:23204)
M /trunk/packages/httpd24/src/httpd24.pas

* Avoid nameclash in apr too
r23208 | michael | 2012-12-22 17:37:50 +0100 (Sat, 22 Dec 2012) | 1 line
Changed paths:
M /trunk/packages/fcl-web/src/base/Makefile
M /trunk/packages/fcl-web/src/base/Makefile.fpc
A /trunk/packages/fcl-web/src/base/fpapache24.pp

* Version of apache module application that works with Apache 2.4
r23209 | michael | 2012-12-22 17:39:18 +0100 (Sat, 22 Dec 2012) | 1 line
Changed paths:
M /trunk/packages/fcl-web/fpmake.pp

* Compile fpapache24
r23242 | pierre | 2012-12-28 16:33:58 +0100 (Fri, 28 Dec 2012) | 1 line
Changed paths:
M /trunk/packages/fcl-web/fpmake.pp

CustHttpApp.pp has no resource strings
r23244 | florian | 2012-12-28 22:51:57 +0100 (Fri, 28 Dec 2012) | 1 line
Changed paths:
M /trunk/packages/httpd24/src/apr/apr_mmap.inc

* patch by olivier to fix BeOS compilation, resolves #23545

git-svn-id: branches/fixes_2_6@24559 -

marco 12 years ago
parent
commit
02726f1adc
40 changed files with 22901 additions and 130 deletions
  1. 34 0
      .gitattributes
  2. 120 40
      packages/Makefile
  3. 21 21
      packages/Makefile.fpc
  4. 8 1
      packages/fcl-web/fpmake.pp
  5. 169 66
      packages/fcl-web/src/base/Makefile
  6. 2 2
      packages/fcl-web/src/base/Makefile.fpc
  7. 781 0
      packages/fcl-web/src/base/fpapache24.pp
  8. 2804 0
      packages/httpd24/Makefile
  9. 28 0
      packages/httpd24/Makefile.fpc
  10. 2411 0
      packages/httpd24/examples/Makefile
  11. 19 0
      packages/httpd24/examples/Makefile.fpc
  12. 105 0
      packages/httpd24/examples/mod_hello.pp
  13. 76 0
      packages/httpd24/fpmake.pp
  14. 210 0
      packages/httpd24/src/ap_config.inc
  15. 450 0
      packages/httpd24/src/ap_expr.inc
  16. 438 0
      packages/httpd24/src/ap_mmn.inc
  17. 268 0
      packages/httpd24/src/ap_regex.inc
  18. 77 0
      packages/httpd24/src/ap_release.inc
  19. 142 0
      packages/httpd24/src/apr/apr.pas
  20. 142 0
      packages/httpd24/src/apr/apr24.pas
  21. 182 0
      packages/httpd24/src/apr/apr_allocator.inc
  22. 1319 0
      packages/httpd24/src/apr/apr_errno.inc
  23. 488 0
      packages/httpd24/src/apr/apr_file_info.inc
  24. 180 0
      packages/httpd24/src/apr/apr_mmap.inc
  25. 922 0
      packages/httpd24/src/apr/apr_pools.inc
  26. 432 0
      packages/httpd24/src/apr/apr_strings.inc
  27. 583 0
      packages/httpd24/src/apr/apr_tables.inc
  28. 283 0
      packages/httpd24/src/apr/apr_time.inc
  29. 181 0
      packages/httpd24/src/apr/apr_user.inc
  30. 162 0
      packages/httpd24/src/apr/apr_version.inc
  31. 1654 0
      packages/httpd24/src/aprutil/apr_buckets.inc
  32. 191 0
      packages/httpd24/src/aprutil/apr_uri.inc
  33. 1766 0
      packages/httpd24/src/http_config.inc
  34. 1122 0
      packages/httpd24/src/http_core.inc
  35. 743 0
      packages/httpd24/src/http_log.inc
  36. 1088 0
      packages/httpd24/src/http_protocol.inc
  37. 2244 0
      packages/httpd24/src/httpd.inc
  38. 275 0
      packages/httpd24/src/httpd24.pas
  39. 94 0
      packages/httpd24/src/util_cfgtree.inc
  40. 687 0
      packages/httpd24/src/util_filter.inc

+ 34 - 0
.gitattributes

@@ -2688,6 +2688,7 @@ packages/fcl-web/src/base/custweb.pp svneol=native#text/plain
 packages/fcl-web/src/base/ezcgi.pp svneol=native#text/plain
 packages/fcl-web/src/base/fcgigate.pp svneol=native#text/plain
 packages/fcl-web/src/base/fpapache.pp svneol=native#text/plain
+packages/fcl-web/src/base/fpapache24.pp svneol=native#text/plain
 packages/fcl-web/src/base/fpcgi.pp svneol=native#text/plain
 packages/fcl-web/src/base/fpdatasetform.pp svneol=native#text/plain
 packages/fcl-web/src/base/fpfcgi.pp svneol=native#text/plain
@@ -3894,6 +3895,39 @@ packages/httpd22/src/util_filter.inc svneol=native#text/plain
 packages/httpd22/src/util_md5.inc svneol=native#text/plain
 packages/httpd22/src/util_script.inc svneol=native#text/plain
 packages/httpd22/src/util_time.inc svneol=native#text/plain
+packages/httpd24/Makefile svneol=native#text/plain
+packages/httpd24/Makefile.fpc svneol=native#text/plain
+packages/httpd24/examples/Makefile svneol=native#text/plain
+packages/httpd24/examples/Makefile.fpc svneol=native#text/plain
+packages/httpd24/examples/mod_hello.pp svneol=native#text/plain
+packages/httpd24/fpmake.pp svneol=native#text/plain
+packages/httpd24/src/ap_config.inc svneol=native#text/plain
+packages/httpd24/src/ap_expr.inc svneol=native#text/plain
+packages/httpd24/src/ap_mmn.inc svneol=native#text/plain
+packages/httpd24/src/ap_regex.inc svneol=native#text/plain
+packages/httpd24/src/ap_release.inc svneol=native#text/plain
+packages/httpd24/src/apr/apr.pas svneol=native#text/plain
+packages/httpd24/src/apr/apr24.pas svneol=native#text/plain
+packages/httpd24/src/apr/apr_allocator.inc svneol=native#text/plain
+packages/httpd24/src/apr/apr_errno.inc svneol=native#text/plain
+packages/httpd24/src/apr/apr_file_info.inc svneol=native#text/plain
+packages/httpd24/src/apr/apr_mmap.inc svneol=native#text/plain
+packages/httpd24/src/apr/apr_pools.inc svneol=native#text/plain
+packages/httpd24/src/apr/apr_strings.inc svneol=native#text/plain
+packages/httpd24/src/apr/apr_tables.inc svneol=native#text/plain
+packages/httpd24/src/apr/apr_time.inc svneol=native#text/plain
+packages/httpd24/src/apr/apr_user.inc svneol=native#text/plain
+packages/httpd24/src/apr/apr_version.inc svneol=native#text/plain
+packages/httpd24/src/aprutil/apr_buckets.inc svneol=native#text/plain
+packages/httpd24/src/aprutil/apr_uri.inc svneol=native#text/plain
+packages/httpd24/src/http_config.inc svneol=native#text/plain
+packages/httpd24/src/http_core.inc svneol=native#text/plain
+packages/httpd24/src/http_log.inc svneol=native#text/plain
+packages/httpd24/src/http_protocol.inc svneol=native#text/plain
+packages/httpd24/src/httpd.inc svneol=native#text/plain
+packages/httpd24/src/httpd24.pas svneol=native#text/plain
+packages/httpd24/src/util_cfgtree.inc svneol=native#text/plain
+packages/httpd24/src/util_filter.inc svneol=native#text/plain
 packages/ibase/Makefile svneol=native#text/plain
 packages/ibase/Makefile.fpc svneol=native#text/plain
 packages/ibase/README.txt svneol=native#text/plain

+ 120 - 40
packages/Makefile

@@ -287,31 +287,31 @@ FPCFPMAKE=$(FPC)
 endif
 endif
 ifeq ($(FULL_TARGET),i386-linux)
-override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fppkg  fv fcl-web fastcgi fcl-async ibase mysql ncurses unzip zlib oracle dbus odbc postgres sqlite pthreads imagemagick gdbint libpng x11 uuid ldap modplug dts mad  gdbm tcl syslog libcurl opengl opencl cairo gtk1 gtk2 librsvg a52 bfd aspell svgalib newt cdrom users  iconvenc libxml proj4 fcl-extra zorba imlib utmp  fpgtk openal lua oggvorbis xforms fftw pcap ggi sdl openssl gnome1  httpd22 pxlib numlib gmp libsee ptc dblib fpindexer graph libc unixutil graph pxlib bzip2
+override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fppkg  fv fcl-web fastcgi fcl-async ibase mysql ncurses unzip zlib oracle dbus odbc postgres sqlite pthreads imagemagick gdbint libpng x11 uuid ldap modplug dts mad  gdbm tcl syslog libcurl opengl opencl cairo gtk1 gtk2 librsvg a52 bfd aspell svgalib newt cdrom users  iconvenc libxml proj4 fcl-extra zorba imlib utmp  fpgtk openal lua oggvorbis xforms fftw pcap ggi sdl openssl gnome1  httpd22 httpd24  pxlib numlib gmp libsee ptc dblib fpindexer graph libc unixutil graph pxlib bzip2
 endif
 ifeq ($(FULL_TARGET),i386-go32v2)
 override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fppkg  fv graph unzip gdbint
 endif
 ifeq ($(FULL_TARGET),i386-win32)
-override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fppkg  fv winunits-base winunits-jedi fcl-web fastcgi ibase mysql zlib oracle odbc postgres sqlite imagemagick gdbint libpng mad tcl opengl gtk1 gtk2 librsvg a52 cdrom fpgtk openal fftw lua fcl-extra zorba oggvorbis sdl openssl graph pcap  httpd22 pxlib numlib winceunits cairo libxml gmp opencl libsee nvapi ptc aspell dblib fpindexer
+override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fppkg  fv winunits-base winunits-jedi fcl-web fastcgi ibase mysql zlib oracle odbc postgres sqlite imagemagick gdbint libpng mad tcl opengl gtk1 gtk2 librsvg a52 cdrom fpgtk openal fftw lua fcl-extra zorba oggvorbis sdl openssl graph pcap  httpd22 httpd24  pxlib numlib winceunits cairo libxml gmp opencl libsee nvapi ptc aspell dblib fpindexer
 endif
 ifeq ($(FULL_TARGET),i386-os2)
 override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fppkg  fv zlib libpng x11 tcl fpgtk rexx os2units gtk1 imlib
 endif
 ifeq ($(FULL_TARGET),i386-freebsd)
-override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fppkg  fv fcl-web fastcgi fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick gdbint libpng x11 gdbm tcl syslog libcurl opengl cairo  bfd aspell svgalib imlib utmp  fpgtk xforms fftw pcap ggi sdl openssl graph gnome1 gtk1 gtk2 librsvg  httpd22 pxlib numlib users iconvenc gmp fcl-extra libxml dblib fpindexer
+override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fppkg  fv fcl-web fastcgi fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick gdbint libpng x11 gdbm tcl syslog libcurl opengl cairo  bfd aspell svgalib imlib utmp  fpgtk xforms fftw pcap ggi sdl openssl graph gnome1 gtk1 gtk2 librsvg  httpd22 httpd24  pxlib numlib users iconvenc gmp fcl-extra libxml dblib fpindexer
 endif
 ifeq ($(FULL_TARGET),i386-beos)
-override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fppkg  fv fcl-web fastcgi fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick gdbint libpng x11 gdbm tcl syslog libcurl opengl cairo bfd aspell svgalib imlib utmp  fpgtk xforms fftw pcap ggi sdl openssl graph gnome1 gtk1 gtk2 librsvg  httpd22 pxlib numlib iconvenc fpindexer
+override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fppkg  fv fcl-web fastcgi fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick gdbint libpng x11 gdbm tcl syslog libcurl opengl cairo bfd aspell svgalib imlib utmp  fpgtk xforms fftw pcap ggi sdl openssl graph gnome1 gtk1 gtk2 librsvg  httpd22 httpd24  pxlib numlib iconvenc fpindexer
 endif
 ifeq ($(FULL_TARGET),i386-haiku)
-override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fppkg  fv fcl-web fastcgi fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick gdbint libpng x11 gdbm tcl syslog libcurl opengl cairo bfd aspell svgalib imlib utmp  fpgtk xforms fftw pcap ggi sdl openssl graph gnome1 gtk1 gtk2 librsvg  httpd22 pxlib numlib iconvenc dblib fpindexer
+override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fppkg  fv fcl-web fastcgi fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick gdbint libpng x11 gdbm tcl syslog libcurl opengl cairo bfd aspell svgalib imlib utmp  fpgtk xforms fftw pcap ggi sdl openssl graph gnome1 gtk1 gtk2 librsvg  httpd22 httpd24  pxlib numlib iconvenc dblib fpindexer
 endif
 ifeq ($(FULL_TARGET),i386-netbsd)
-override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fppkg  fv fcl-web fastcgi fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick gdbint libpng x11 gdbm tcl syslog libcurl opengl cairo gtk1 gtk2 librsvg bfd aspell svgalib imlib utmp  fpgtk xforms fftw pcap ggi sdl openssl gnome1  httpd22 pxlib numlib dblib fpindexer
+override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fppkg  fv fcl-web fastcgi fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick gdbint libpng x11 gdbm tcl syslog libcurl opengl cairo gtk1 gtk2 librsvg bfd aspell svgalib imlib utmp  fpgtk xforms fftw pcap ggi sdl openssl gnome1  httpd22 httpd24  pxlib numlib dblib fpindexer
 endif
 ifeq ($(FULL_TARGET),i386-solaris)
-override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fppkg  fv fcl-web fastcgi fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick libpng x11 gdbm tcl syslog libcurl opengl cairo gtk1 bfd svgalib fcl-extra imlib utmp  fpgtk xforms fftw pcap ggi  openssl gnome1  httpd22 numlib iconvenc gtk2 cairo dblib fpindexer dblib
+override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fppkg  fv fcl-web fastcgi fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick libpng x11 gdbm tcl syslog libcurl opengl cairo gtk1 bfd svgalib fcl-extra imlib utmp  fpgtk xforms fftw pcap ggi  openssl gnome1  httpd22 httpd24  numlib iconvenc gtk2 cairo dblib fpindexer dblib
 endif
 ifeq ($(FULL_TARGET),i386-qnx)
 override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fppkg
@@ -320,13 +320,13 @@ ifeq ($(FULL_TARGET),i386-netware)
 override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fppkg  fv zlib unzip
 endif
 ifeq ($(FULL_TARGET),i386-openbsd)
-override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fppkg  fv fcl-web fastcgi fcl-async ibase mysql ncurses zlib oracle odbc  postgres sqlite pthreads imagemagick gdbint libpng x11 gdbm tcl syslog libcurl opengl cairo gtk1 gtk2 librsvg bfd aspell svgalib imlib utmp  fpgtk xforms fftw pcap ggi sdl openssl gnome1  httpd22 pxlib numlib dblib fpindexer
+override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fppkg  fv fcl-web fastcgi fcl-async ibase mysql ncurses zlib oracle odbc  postgres sqlite pthreads imagemagick gdbint libpng x11 gdbm tcl syslog libcurl opengl cairo gtk1 gtk2 librsvg bfd aspell svgalib imlib utmp  fpgtk xforms fftw pcap ggi sdl openssl gnome1  httpd22 httpd24  pxlib numlib dblib fpindexer
 endif
 ifeq ($(FULL_TARGET),i386-wdosx)
 override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fppkg
 endif
 ifeq ($(FULL_TARGET),i386-darwin)
-override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fppkg  fv fcl-web fastcgi fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick libpng gdbm tcl syslog libcurl bfd aspell utmp fftw pcap openssl numlib iconvenc gmp fcl-extra univint dblib fpindexer graph sdl opengl x11 cairo gtk1 gtk2 librsvg fpgtk xforms gnome1  httpd22 imlib objcrtl cocoaint opencl openal
+override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fppkg  fv fcl-web fastcgi fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick libpng gdbm tcl syslog libcurl bfd aspell utmp fftw pcap openssl numlib iconvenc gmp fcl-extra univint dblib fpindexer graph sdl opengl x11 cairo gtk1 gtk2 librsvg fpgtk xforms gnome1  httpd22 httpd24  imlib objcrtl cocoaint opencl openal
 endif
 ifeq ($(FULL_TARGET),i386-emx)
 override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fppkg  fv zlib libpng x11 tcl fpgtk rexx os2units gtk1 imlib
@@ -338,7 +338,7 @@ ifeq ($(FULL_TARGET),i386-netwlibc)
 override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fppkg  fv zlib unzip
 endif
 ifeq ($(FULL_TARGET),i386-wince)
-override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fppkg  winceunits httpd22 fcl-web fastcgi tcl fftw unzip zlib sqlite mysql ibase postgres oracle odbc sdl openssl oggvorbis numlib dblib fpindexer
+override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fppkg  winceunits httpd22 httpd24  fcl-web fastcgi tcl fftw unzip zlib sqlite mysql ibase postgres oracle odbc sdl openssl oggvorbis numlib dblib fpindexer
 endif
 ifeq ($(FULL_TARGET),i386-embedded)
 override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fppkg
@@ -350,16 +350,16 @@ ifeq ($(FULL_TARGET),i386-nativent)
 override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fppkg
 endif
 ifeq ($(FULL_TARGET),i386-iphonesim)
-override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fppkg  fv fcl-web fastcgi fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick libpng gdbm tcl syslog libcurl bfd aspell utmp fftw pcap openssl numlib iconvenc gmp fcl-extra univint fpindexer httpd22 opengles objcrtl dblib
+override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fppkg  fv fcl-web fastcgi fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick libpng gdbm tcl syslog libcurl bfd aspell utmp fftw pcap openssl numlib iconvenc gmp fcl-extra univint fpindexer httpd22 httpd24  opengles objcrtl dblib
 endif
 ifeq ($(FULL_TARGET),m68k-linux)
-override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fppkg  fv fcl-web fastcgi fcl-async ibase mysql ncurses unzip zlib oracle dbus odbc postgres sqlite pthreads imagemagick gdbint libpng x11 uuid ldap modplug dts mad  gdbm tcl syslog libcurl opengl opencl cairo gtk1 gtk2 librsvg a52 bfd aspell svgalib newt cdrom users  iconvenc libxml proj4 fcl-extra zorba imlib utmp  fpgtk openal lua oggvorbis xforms fftw pcap ggi sdl openssl gnome1  httpd22 pxlib numlib gmp libsee ptc dblib fpindexer graph
+override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fppkg  fv fcl-web fastcgi fcl-async ibase mysql ncurses unzip zlib oracle dbus odbc postgres sqlite pthreads imagemagick gdbint libpng x11 uuid ldap modplug dts mad  gdbm tcl syslog libcurl opengl opencl cairo gtk1 gtk2 librsvg a52 bfd aspell svgalib newt cdrom users  iconvenc libxml proj4 fcl-extra zorba imlib utmp  fpgtk openal lua oggvorbis xforms fftw pcap ggi sdl openssl gnome1  httpd22 httpd24  pxlib numlib gmp libsee ptc dblib fpindexer graph
 endif
 ifeq ($(FULL_TARGET),m68k-freebsd)
-override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fppkg  fv fcl-web fastcgi fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick gdbint libpng x11 gdbm tcl syslog libcurl opengl cairo  bfd aspell svgalib imlib utmp  fpgtk xforms fftw pcap ggi sdl openssl graph gnome1 gtk1 gtk2 librsvg  httpd22 pxlib numlib users iconvenc gmp fcl-extra libxml dblib fpindexer
+override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fppkg  fv fcl-web fastcgi fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick gdbint libpng x11 gdbm tcl syslog libcurl opengl cairo  bfd aspell svgalib imlib utmp  fpgtk xforms fftw pcap ggi sdl openssl graph gnome1 gtk1 gtk2 librsvg  httpd22 httpd24  pxlib numlib users iconvenc gmp fcl-extra libxml dblib fpindexer
 endif
 ifeq ($(FULL_TARGET),m68k-netbsd)
-override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fppkg  fv fcl-web fastcgi fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick gdbint libpng x11 gdbm tcl syslog libcurl opengl cairo gtk1 gtk2 librsvg bfd aspell svgalib imlib utmp  fpgtk xforms fftw pcap ggi sdl openssl gnome1  httpd22 pxlib numlib dblib fpindexer
+override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fppkg  fv fcl-web fastcgi fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick gdbint libpng x11 gdbm tcl syslog libcurl opengl cairo gtk1 gtk2 librsvg bfd aspell svgalib imlib utmp  fpgtk xforms fftw pcap ggi sdl openssl gnome1  httpd22 httpd24  pxlib numlib dblib fpindexer
 endif
 ifeq ($(FULL_TARGET),m68k-amiga)
 override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fppkg  amunits
@@ -368,7 +368,7 @@ ifeq ($(FULL_TARGET),m68k-atari)
 override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fppkg
 endif
 ifeq ($(FULL_TARGET),m68k-openbsd)
-override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fppkg  fv fcl-web fastcgi fcl-async ibase mysql ncurses zlib oracle odbc  postgres sqlite pthreads imagemagick gdbint libpng x11 gdbm tcl syslog libcurl opengl cairo gtk1 gtk2 librsvg bfd aspell svgalib imlib utmp  fpgtk xforms fftw pcap ggi sdl openssl gnome1  httpd22 pxlib numlib dblib fpindexer
+override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fppkg  fv fcl-web fastcgi fcl-async ibase mysql ncurses zlib oracle odbc  postgres sqlite pthreads imagemagick gdbint libpng x11 gdbm tcl syslog libcurl opengl cairo gtk1 gtk2 librsvg bfd aspell svgalib imlib utmp  fpgtk xforms fftw pcap ggi sdl openssl gnome1  httpd22 httpd24  pxlib numlib dblib fpindexer
 endif
 ifeq ($(FULL_TARGET),m68k-palmos)
 override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fppkg  palmunits
@@ -377,10 +377,10 @@ ifeq ($(FULL_TARGET),m68k-embedded)
 override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fppkg
 endif
 ifeq ($(FULL_TARGET),powerpc-linux)
-override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fppkg  fv fcl-web fastcgi fcl-async ibase mysql ncurses unzip zlib oracle dbus odbc postgres sqlite pthreads imagemagick gdbint libpng x11 uuid ldap modplug dts mad  gdbm tcl syslog libcurl opengl opencl cairo gtk1 gtk2 librsvg a52 bfd aspell svgalib newt cdrom users  iconvenc libxml proj4 fcl-extra zorba imlib utmp  fpgtk openal lua oggvorbis xforms fftw pcap ggi sdl openssl gnome1  httpd22 pxlib numlib gmp libsee ptc dblib fpindexer graph
+override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fppkg  fv fcl-web fastcgi fcl-async ibase mysql ncurses unzip zlib oracle dbus odbc postgres sqlite pthreads imagemagick gdbint libpng x11 uuid ldap modplug dts mad  gdbm tcl syslog libcurl opengl opencl cairo gtk1 gtk2 librsvg a52 bfd aspell svgalib newt cdrom users  iconvenc libxml proj4 fcl-extra zorba imlib utmp  fpgtk openal lua oggvorbis xforms fftw pcap ggi sdl openssl gnome1  httpd22 httpd24  pxlib numlib gmp libsee ptc dblib fpindexer graph
 endif
 ifeq ($(FULL_TARGET),powerpc-netbsd)
-override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fppkg  fv fcl-web fastcgi fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick gdbint libpng x11 gdbm tcl syslog libcurl opengl cairo gtk1 gtk2 librsvg bfd aspell svgalib imlib utmp  fpgtk xforms fftw pcap ggi sdl openssl gnome1  httpd22 pxlib numlib dblib fpindexer
+override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fppkg  fv fcl-web fastcgi fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick gdbint libpng x11 gdbm tcl syslog libcurl opengl cairo gtk1 gtk2 librsvg bfd aspell svgalib imlib utmp  fpgtk xforms fftw pcap ggi sdl openssl gnome1  httpd22 httpd24  pxlib numlib dblib fpindexer
 endif
 ifeq ($(FULL_TARGET),powerpc-amiga)
 override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fppkg  amunits
@@ -389,7 +389,7 @@ ifeq ($(FULL_TARGET),powerpc-macos)
 override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fppkg
 endif
 ifeq ($(FULL_TARGET),powerpc-darwin)
-override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fppkg  fv fcl-web fastcgi fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick libpng gdbm tcl syslog libcurl bfd aspell utmp fftw pcap openssl numlib iconvenc gmp fcl-extra univint dblib fpindexer graph sdl opengl x11 cairo gtk1 gtk2 librsvg fpgtk xforms gnome1  httpd22 imlib objcrtl cocoaint
+override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fppkg  fv fcl-web fastcgi fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick libpng gdbm tcl syslog libcurl bfd aspell utmp fftw pcap openssl numlib iconvenc gmp fcl-extra univint dblib fpindexer graph sdl opengl x11 cairo gtk1 gtk2 librsvg fpgtk xforms gnome1  httpd22 httpd24  imlib objcrtl cocoaint
 endif
 ifeq ($(FULL_TARGET),powerpc-morphos)
 override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fppkg  fv opengl sdl
@@ -401,52 +401,52 @@ ifeq ($(FULL_TARGET),powerpc-wii)
 override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fppkg  libogcfpc
 endif
 ifeq ($(FULL_TARGET),sparc-linux)
-override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fppkg  fv fcl-web fastcgi fcl-async ibase mysql ncurses unzip zlib oracle dbus odbc postgres sqlite pthreads imagemagick gdbint libpng x11 uuid ldap modplug dts mad  gdbm tcl syslog libcurl opengl opencl cairo gtk1 gtk2 librsvg a52 bfd aspell svgalib newt cdrom users  iconvenc libxml proj4 fcl-extra zorba imlib utmp  fpgtk openal lua oggvorbis xforms fftw pcap ggi sdl openssl gnome1  httpd22 pxlib numlib gmp libsee ptc dblib fpindexer graph
+override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fppkg  fv fcl-web fastcgi fcl-async ibase mysql ncurses unzip zlib oracle dbus odbc postgres sqlite pthreads imagemagick gdbint libpng x11 uuid ldap modplug dts mad  gdbm tcl syslog libcurl opengl opencl cairo gtk1 gtk2 librsvg a52 bfd aspell svgalib newt cdrom users  iconvenc libxml proj4 fcl-extra zorba imlib utmp  fpgtk openal lua oggvorbis xforms fftw pcap ggi sdl openssl gnome1  httpd22 httpd24  pxlib numlib gmp libsee ptc dblib fpindexer graph
 endif
 ifeq ($(FULL_TARGET),sparc-netbsd)
-override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fppkg  fv fcl-web fastcgi fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick gdbint libpng x11 gdbm tcl syslog libcurl opengl cairo gtk1 gtk2 librsvg bfd aspell svgalib imlib utmp  fpgtk xforms fftw pcap ggi sdl openssl gnome1  httpd22 pxlib numlib dblib fpindexer
+override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fppkg  fv fcl-web fastcgi fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick gdbint libpng x11 gdbm tcl syslog libcurl opengl cairo gtk1 gtk2 librsvg bfd aspell svgalib imlib utmp  fpgtk xforms fftw pcap ggi sdl openssl gnome1  httpd22 httpd24  pxlib numlib dblib fpindexer
 endif
 ifeq ($(FULL_TARGET),sparc-solaris)
-override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fppkg  fv fcl-web fastcgi fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick libpng x11 gdbm tcl syslog libcurl opengl cairo gtk1 bfd svgalib fcl-extra imlib utmp  fpgtk xforms fftw pcap ggi  openssl gnome1  httpd22 numlib iconvenc gtk2 cairo dblib fpindexer dblib
+override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fppkg  fv fcl-web fastcgi fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick libpng x11 gdbm tcl syslog libcurl opengl cairo gtk1 bfd svgalib fcl-extra imlib utmp  fpgtk xforms fftw pcap ggi  openssl gnome1  httpd22 httpd24  numlib iconvenc gtk2 cairo dblib fpindexer dblib
 endif
 ifeq ($(FULL_TARGET),sparc-embedded)
 override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fppkg
 endif
 ifeq ($(FULL_TARGET),x86_64-linux)
-override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fppkg  fv fcl-web fastcgi fcl-async ibase mysql ncurses unzip zlib oracle dbus odbc postgres sqlite pthreads imagemagick gdbint libpng x11 uuid ldap modplug dts mad  gdbm tcl syslog libcurl opengl opencl cairo gtk1 gtk2 librsvg a52 bfd aspell svgalib newt cdrom users  iconvenc libxml proj4 fcl-extra zorba imlib utmp  fpgtk openal lua oggvorbis xforms fftw pcap ggi sdl openssl gnome1  httpd22 pxlib numlib gmp libsee ptc dblib fpindexer graph
+override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fppkg  fv fcl-web fastcgi fcl-async ibase mysql ncurses unzip zlib oracle dbus odbc postgres sqlite pthreads imagemagick gdbint libpng x11 uuid ldap modplug dts mad  gdbm tcl syslog libcurl opengl opencl cairo gtk1 gtk2 librsvg a52 bfd aspell svgalib newt cdrom users  iconvenc libxml proj4 fcl-extra zorba imlib utmp  fpgtk openal lua oggvorbis xforms fftw pcap ggi sdl openssl gnome1  httpd22 httpd24  pxlib numlib gmp libsee ptc dblib fpindexer graph
 endif
 ifeq ($(FULL_TARGET),x86_64-freebsd)
-override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fppkg  fv fcl-web fastcgi fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick gdbint libpng x11 gdbm tcl syslog libcurl opengl cairo  bfd aspell svgalib imlib utmp  fpgtk xforms fftw pcap ggi sdl openssl graph gnome1 gtk1 gtk2 librsvg  httpd22 pxlib numlib users iconvenc gmp fcl-extra libxml dblib fpindexer
+override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fppkg  fv fcl-web fastcgi fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick gdbint libpng x11 gdbm tcl syslog libcurl opengl cairo  bfd aspell svgalib imlib utmp  fpgtk xforms fftw pcap ggi sdl openssl graph gnome1 gtk1 gtk2 librsvg  httpd22 httpd24  pxlib numlib users iconvenc gmp fcl-extra libxml dblib fpindexer
 endif
 ifeq ($(FULL_TARGET),x86_64-netbsd)
-override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fppkg  fv fcl-web fastcgi fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick gdbint libpng x11 gdbm tcl syslog libcurl opengl cairo gtk1 gtk2 librsvg bfd aspell svgalib imlib utmp  fpgtk xforms fftw pcap ggi sdl openssl gnome1  httpd22 pxlib numlib dblib fpindexer
+override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fppkg  fv fcl-web fastcgi fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick gdbint libpng x11 gdbm tcl syslog libcurl opengl cairo gtk1 gtk2 librsvg bfd aspell svgalib imlib utmp  fpgtk xforms fftw pcap ggi sdl openssl gnome1  httpd22 httpd24  pxlib numlib dblib fpindexer
 endif
 ifeq ($(FULL_TARGET),x86_64-solaris)
-override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fppkg  fv fcl-web fastcgi fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick libpng x11 gdbm tcl syslog libcurl opengl cairo gtk1 bfd svgalib fcl-extra imlib utmp  fpgtk xforms fftw pcap ggi  openssl gnome1  httpd22 numlib iconvenc gtk2 cairo dblib fpindexer dblib
+override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fppkg  fv fcl-web fastcgi fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick libpng x11 gdbm tcl syslog libcurl opengl cairo gtk1 bfd svgalib fcl-extra imlib utmp  fpgtk xforms fftw pcap ggi  openssl gnome1  httpd22 httpd24  numlib iconvenc gtk2 cairo dblib fpindexer dblib
 endif
 ifeq ($(FULL_TARGET),x86_64-openbsd)
-override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fppkg  fv fcl-web fastcgi fcl-async ibase mysql ncurses zlib oracle odbc  postgres sqlite pthreads imagemagick gdbint libpng x11 gdbm tcl syslog libcurl opengl cairo gtk1 gtk2 librsvg bfd aspell svgalib imlib utmp  fpgtk xforms fftw pcap ggi sdl openssl gnome1  httpd22 pxlib numlib dblib fpindexer
+override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fppkg  fv fcl-web fastcgi fcl-async ibase mysql ncurses zlib oracle odbc  postgres sqlite pthreads imagemagick gdbint libpng x11 gdbm tcl syslog libcurl opengl cairo gtk1 gtk2 librsvg bfd aspell svgalib imlib utmp  fpgtk xforms fftw pcap ggi sdl openssl gnome1  httpd22 httpd24  pxlib numlib dblib fpindexer
 endif
 ifeq ($(FULL_TARGET),x86_64-darwin)
-override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fppkg  fv fcl-web fastcgi fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick libpng gdbm tcl syslog libcurl bfd aspell utmp fftw pcap openssl numlib iconvenc gmp fcl-extra univint dblib fpindexer opengl x11 cairo gtk1 gtk2 librsvg fpgtk xforms gnome1  httpd22 imlib cocoaint
+override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fppkg  fv fcl-web fastcgi fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick libpng gdbm tcl syslog libcurl bfd aspell utmp fftw pcap openssl numlib iconvenc gmp fcl-extra univint dblib fpindexer opengl x11 cairo gtk1 gtk2 librsvg fpgtk xforms gnome1  httpd22 httpd24  imlib cocoaint
 endif
 ifeq ($(FULL_TARGET),x86_64-win64)
-override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fppkg  fv winunits-base winunits-jedi fcl-web fastcgi ibase mysql zlib oracle odbc postgres sqlite imagemagick gdbint tcl opengl gtk1 fpgtk fftw sdl openssl cdrom  httpd22 numlib fcl-extra opencl nvapi ptc graph dblib fpindexer
+override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fppkg  fv winunits-base winunits-jedi fcl-web fastcgi ibase mysql zlib oracle odbc postgres sqlite imagemagick gdbint tcl opengl gtk1 fpgtk fftw sdl openssl cdrom  httpd22 httpd24  numlib fcl-extra opencl nvapi ptc graph dblib fpindexer
 endif
 ifeq ($(FULL_TARGET),x86_64-embedded)
 override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fppkg
 endif
 ifeq ($(FULL_TARGET),arm-linux)
-override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fppkg  fv fcl-web fastcgi fcl-async ibase mysql ncurses unzip zlib oracle dbus odbc postgres sqlite pthreads imagemagick gdbint libpng x11 uuid ldap modplug dts mad  gdbm tcl syslog libcurl opengl opencl cairo gtk1 gtk2 librsvg a52 bfd aspell svgalib newt cdrom users  iconvenc libxml proj4 fcl-extra zorba imlib utmp  fpgtk openal lua oggvorbis xforms fftw pcap ggi sdl openssl gnome1  httpd22 pxlib numlib gmp libsee ptc dblib fpindexer graph
+override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fppkg  fv fcl-web fastcgi fcl-async ibase mysql ncurses unzip zlib oracle dbus odbc postgres sqlite pthreads imagemagick gdbint libpng x11 uuid ldap modplug dts mad  gdbm tcl syslog libcurl opengl opencl cairo gtk1 gtk2 librsvg a52 bfd aspell svgalib newt cdrom users  iconvenc libxml proj4 fcl-extra zorba imlib utmp  fpgtk openal lua oggvorbis xforms fftw pcap ggi sdl openssl gnome1  httpd22 httpd24  pxlib numlib gmp libsee ptc dblib fpindexer graph
 endif
 ifeq ($(FULL_TARGET),arm-palmos)
 override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fppkg  palmunits
 endif
 ifeq ($(FULL_TARGET),arm-darwin)
-override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fppkg  fv fcl-web fastcgi fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick libpng gdbm tcl syslog libcurl bfd aspell utmp fftw pcap openssl numlib iconvenc gmp fcl-extra univint dblib fpindexer httpd22 opengles objcrtl
+override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fppkg  fv fcl-web fastcgi fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick libpng gdbm tcl syslog libcurl bfd aspell utmp fftw pcap openssl numlib iconvenc gmp fcl-extra univint dblib fpindexer httpd22 httpd24  opengles objcrtl
 endif
 ifeq ($(FULL_TARGET),arm-wince)
-override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fppkg  winceunits httpd22 fcl-web fastcgi tcl fftw unzip zlib sqlite mysql ibase postgres oracle odbc sdl openssl oggvorbis numlib dblib fpindexer
+override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fppkg  winceunits httpd22 httpd24  fcl-web fastcgi tcl fftw unzip zlib sqlite mysql ibase postgres oracle odbc sdl openssl oggvorbis numlib dblib fpindexer
 endif
 ifeq ($(FULL_TARGET),arm-gba)
 override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fppkg
@@ -461,10 +461,10 @@ ifeq ($(FULL_TARGET),arm-symbian)
 override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fppkg
 endif
 ifeq ($(FULL_TARGET),powerpc64-linux)
-override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fppkg  fv fcl-web fastcgi fcl-async ibase mysql ncurses unzip zlib oracle dbus odbc postgres sqlite pthreads imagemagick gdbint libpng x11 uuid ldap modplug dts mad  gdbm tcl syslog libcurl opengl opencl cairo gtk1 gtk2 librsvg a52 bfd aspell svgalib newt cdrom users  iconvenc libxml proj4 fcl-extra zorba imlib utmp  fpgtk openal lua oggvorbis xforms fftw pcap ggi sdl openssl gnome1  httpd22 pxlib numlib gmp libsee ptc dblib fpindexer graph
+override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fppkg  fv fcl-web fastcgi fcl-async ibase mysql ncurses unzip zlib oracle dbus odbc postgres sqlite pthreads imagemagick gdbint libpng x11 uuid ldap modplug dts mad  gdbm tcl syslog libcurl opengl opencl cairo gtk1 gtk2 librsvg a52 bfd aspell svgalib newt cdrom users  iconvenc libxml proj4 fcl-extra zorba imlib utmp  fpgtk openal lua oggvorbis xforms fftw pcap ggi sdl openssl gnome1  httpd22 httpd24  pxlib numlib gmp libsee ptc dblib fpindexer graph
 endif
 ifeq ($(FULL_TARGET),powerpc64-darwin)
-override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fppkg  fv fcl-web fastcgi fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick libpng gdbm tcl syslog libcurl bfd aspell utmp fftw pcap openssl numlib iconvenc gmp fcl-extra univint dblib fpindexer opengl x11 cairo gtk1 gtk2 librsvg fpgtk xforms gnome1  httpd22 imlib cocoaint
+override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fppkg  fv fcl-web fastcgi fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick libpng gdbm tcl syslog libcurl bfd aspell utmp fftw pcap openssl numlib iconvenc gmp fcl-extra univint dblib fpindexer opengl x11 cairo gtk1 gtk2 librsvg fpgtk xforms gnome1  httpd22 httpd24  imlib cocoaint
 endif
 ifeq ($(FULL_TARGET),powerpc64-embedded)
 override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fppkg
@@ -473,13 +473,13 @@ ifeq ($(FULL_TARGET),avr-embedded)
 override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fppkg
 endif
 ifeq ($(FULL_TARGET),armeb-linux)
-override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fppkg  fv fcl-web fastcgi fcl-async ibase mysql ncurses unzip zlib oracle dbus odbc postgres sqlite pthreads imagemagick gdbint libpng x11 uuid ldap modplug dts mad  gdbm tcl syslog libcurl opengl opencl cairo gtk1 gtk2 librsvg a52 bfd aspell svgalib newt cdrom users  iconvenc libxml proj4 fcl-extra zorba imlib utmp  fpgtk openal lua oggvorbis xforms fftw pcap ggi sdl openssl gnome1  httpd22 pxlib numlib gmp libsee ptc dblib fpindexer
+override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fppkg  fv fcl-web fastcgi fcl-async ibase mysql ncurses unzip zlib oracle dbus odbc postgres sqlite pthreads imagemagick gdbint libpng x11 uuid ldap modplug dts mad  gdbm tcl syslog libcurl opengl opencl cairo gtk1 gtk2 librsvg a52 bfd aspell svgalib newt cdrom users  iconvenc libxml proj4 fcl-extra zorba imlib utmp  fpgtk openal lua oggvorbis xforms fftw pcap ggi sdl openssl gnome1  httpd22 httpd24  pxlib numlib gmp libsee ptc dblib fpindexer
 endif
 ifeq ($(FULL_TARGET),armeb-embedded)
 override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fppkg
 endif
 ifeq ($(FULL_TARGET),mipsel-linux)
-override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fppkg  fv fcl-web fastcgi fcl-async ibase mysql ncurses unzip zlib oracle dbus odbc postgres sqlite pthreads imagemagick gdbint libpng x11 uuid ldap modplug dts mad  gdbm tcl syslog libcurl opengl opencl cairo gtk1 gtk2 librsvg a52 bfd aspell svgalib newt cdrom users  iconvenc libxml proj4 fcl-extra zorba imlib utmp  fpgtk openal lua oggvorbis xforms fftw pcap ggi sdl openssl gnome1  httpd22 pxlib numlib gmp libsee ptc dblib fpindexer
+override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fppkg  fv fcl-web fastcgi fcl-async ibase mysql ncurses unzip zlib oracle dbus odbc postgres sqlite pthreads imagemagick gdbint libpng x11 uuid ldap modplug dts mad  gdbm tcl syslog libcurl opengl opencl cairo gtk1 gtk2 librsvg a52 bfd aspell svgalib newt cdrom users  iconvenc libxml proj4 fcl-extra zorba imlib utmp  fpgtk openal lua oggvorbis xforms fftw pcap ggi sdl openssl gnome1  httpd22 httpd24  pxlib numlib gmp libsee ptc dblib fpindexer
 endif
 override INSTALL_FPCPACKAGE=y
 override INSTALL_FPCSUBDIR=packages
@@ -1508,6 +1508,7 @@ TARGET_DIRS_SDL=1
 TARGET_DIRS_OPENSSL=1
 TARGET_DIRS_GNOME1=1
 TARGET_DIRS_HTTPD22=1
+TARGET_DIRS_HTTPD24=1
 TARGET_DIRS_PXLIB=1
 TARGET_DIRS_NUMLIB=1
 TARGET_DIRS_GMP=1
@@ -1612,6 +1613,7 @@ TARGET_DIRS_OPENSSL=1
 TARGET_DIRS_GRAPH=1
 TARGET_DIRS_PCAP=1
 TARGET_DIRS_HTTPD22=1
+TARGET_DIRS_HTTPD24=1
 TARGET_DIRS_PXLIB=1
 TARGET_DIRS_NUMLIB=1
 TARGET_DIRS_WINCEUNITS=1
@@ -1728,6 +1730,7 @@ TARGET_DIRS_GTK1=1
 TARGET_DIRS_GTK2=1
 TARGET_DIRS_LIBRSVG=1
 TARGET_DIRS_HTTPD22=1
+TARGET_DIRS_HTTPD24=1
 TARGET_DIRS_PXLIB=1
 TARGET_DIRS_NUMLIB=1
 TARGET_DIRS_USERS=1
@@ -1804,6 +1807,7 @@ TARGET_DIRS_GTK1=1
 TARGET_DIRS_GTK2=1
 TARGET_DIRS_LIBRSVG=1
 TARGET_DIRS_HTTPD22=1
+TARGET_DIRS_HTTPD24=1
 TARGET_DIRS_PXLIB=1
 TARGET_DIRS_NUMLIB=1
 TARGET_DIRS_ICONVENC=1
@@ -1875,6 +1879,7 @@ TARGET_DIRS_GTK1=1
 TARGET_DIRS_GTK2=1
 TARGET_DIRS_LIBRSVG=1
 TARGET_DIRS_HTTPD22=1
+TARGET_DIRS_HTTPD24=1
 TARGET_DIRS_PXLIB=1
 TARGET_DIRS_NUMLIB=1
 TARGET_DIRS_ICONVENC=1
@@ -1946,6 +1951,7 @@ TARGET_DIRS_SDL=1
 TARGET_DIRS_OPENSSL=1
 TARGET_DIRS_GNOME1=1
 TARGET_DIRS_HTTPD22=1
+TARGET_DIRS_HTTPD24=1
 TARGET_DIRS_PXLIB=1
 TARGET_DIRS_NUMLIB=1
 TARGET_DIRS_DBLIB=1
@@ -2012,6 +2018,7 @@ TARGET_DIRS_GGI=1
 TARGET_DIRS_OPENSSL=1
 TARGET_DIRS_GNOME1=1
 TARGET_DIRS_HTTPD22=1
+TARGET_DIRS_HTTPD24=1
 TARGET_DIRS_NUMLIB=1
 TARGET_DIRS_ICONVENC=1
 TARGET_DIRS_GTK2=1
@@ -2140,6 +2147,7 @@ TARGET_DIRS_SDL=1
 TARGET_DIRS_OPENSSL=1
 TARGET_DIRS_GNOME1=1
 TARGET_DIRS_HTTPD22=1
+TARGET_DIRS_HTTPD24=1
 TARGET_DIRS_PXLIB=1
 TARGET_DIRS_NUMLIB=1
 TARGET_DIRS_DBLIB=1
@@ -2240,6 +2248,7 @@ TARGET_DIRS_FPGTK=1
 TARGET_DIRS_XFORMS=1
 TARGET_DIRS_GNOME1=1
 TARGET_DIRS_HTTPD22=1
+TARGET_DIRS_HTTPD24=1
 TARGET_DIRS_IMLIB=1
 TARGET_DIRS_OBJCRTL=1
 TARGET_DIRS_COCOAINT=1
@@ -2364,6 +2373,7 @@ TARGET_DIRS_HERMES=1
 TARGET_DIRS_FPPKG=1
 TARGET_DIRS_WINCEUNITS=1
 TARGET_DIRS_HTTPD22=1
+TARGET_DIRS_HTTPD24=1
 TARGET_DIRS_FCL-WEB=1
 TARGET_DIRS_FASTCGI=1
 TARGET_DIRS_TCL=1
@@ -2518,6 +2528,7 @@ TARGET_DIRS_FCL-EXTRA=1
 TARGET_DIRS_UNIVINT=1
 TARGET_DIRS_FPINDEXER=1
 TARGET_DIRS_HTTPD22=1
+TARGET_DIRS_HTTPD24=1
 TARGET_DIRS_OPENGLES=1
 TARGET_DIRS_OBJCRTL=1
 TARGET_DIRS_DBLIB=1
@@ -2607,6 +2618,7 @@ TARGET_DIRS_SDL=1
 TARGET_DIRS_OPENSSL=1
 TARGET_DIRS_GNOME1=1
 TARGET_DIRS_HTTPD22=1
+TARGET_DIRS_HTTPD24=1
 TARGET_DIRS_PXLIB=1
 TARGET_DIRS_NUMLIB=1
 TARGET_DIRS_GMP=1
@@ -2682,6 +2694,7 @@ TARGET_DIRS_GTK1=1
 TARGET_DIRS_GTK2=1
 TARGET_DIRS_LIBRSVG=1
 TARGET_DIRS_HTTPD22=1
+TARGET_DIRS_HTTPD24=1
 TARGET_DIRS_PXLIB=1
 TARGET_DIRS_NUMLIB=1
 TARGET_DIRS_USERS=1
@@ -2757,6 +2770,7 @@ TARGET_DIRS_SDL=1
 TARGET_DIRS_OPENSSL=1
 TARGET_DIRS_GNOME1=1
 TARGET_DIRS_HTTPD22=1
+TARGET_DIRS_HTTPD24=1
 TARGET_DIRS_PXLIB=1
 TARGET_DIRS_NUMLIB=1
 TARGET_DIRS_DBLIB=1
@@ -2880,6 +2894,7 @@ TARGET_DIRS_SDL=1
 TARGET_DIRS_OPENSSL=1
 TARGET_DIRS_GNOME1=1
 TARGET_DIRS_HTTPD22=1
+TARGET_DIRS_HTTPD24=1
 TARGET_DIRS_PXLIB=1
 TARGET_DIRS_NUMLIB=1
 TARGET_DIRS_DBLIB=1
@@ -3023,6 +3038,7 @@ TARGET_DIRS_SDL=1
 TARGET_DIRS_OPENSSL=1
 TARGET_DIRS_GNOME1=1
 TARGET_DIRS_HTTPD22=1
+TARGET_DIRS_HTTPD24=1
 TARGET_DIRS_PXLIB=1
 TARGET_DIRS_NUMLIB=1
 TARGET_DIRS_GMP=1
@@ -3097,6 +3113,7 @@ TARGET_DIRS_SDL=1
 TARGET_DIRS_OPENSSL=1
 TARGET_DIRS_GNOME1=1
 TARGET_DIRS_HTTPD22=1
+TARGET_DIRS_HTTPD24=1
 TARGET_DIRS_PXLIB=1
 TARGET_DIRS_NUMLIB=1
 TARGET_DIRS_DBLIB=1
@@ -3224,6 +3241,7 @@ TARGET_DIRS_FPGTK=1
 TARGET_DIRS_XFORMS=1
 TARGET_DIRS_GNOME1=1
 TARGET_DIRS_HTTPD22=1
+TARGET_DIRS_HTTPD24=1
 TARGET_DIRS_IMLIB=1
 TARGET_DIRS_OBJCRTL=1
 TARGET_DIRS_COCOAINT=1
@@ -3395,6 +3413,7 @@ TARGET_DIRS_SDL=1
 TARGET_DIRS_OPENSSL=1
 TARGET_DIRS_GNOME1=1
 TARGET_DIRS_HTTPD22=1
+TARGET_DIRS_HTTPD24=1
 TARGET_DIRS_PXLIB=1
 TARGET_DIRS_NUMLIB=1
 TARGET_DIRS_GMP=1
@@ -3469,6 +3488,7 @@ TARGET_DIRS_SDL=1
 TARGET_DIRS_OPENSSL=1
 TARGET_DIRS_GNOME1=1
 TARGET_DIRS_HTTPD22=1
+TARGET_DIRS_HTTPD24=1
 TARGET_DIRS_PXLIB=1
 TARGET_DIRS_NUMLIB=1
 TARGET_DIRS_DBLIB=1
@@ -3535,6 +3555,7 @@ TARGET_DIRS_GGI=1
 TARGET_DIRS_OPENSSL=1
 TARGET_DIRS_GNOME1=1
 TARGET_DIRS_HTTPD22=1
+TARGET_DIRS_HTTPD24=1
 TARGET_DIRS_NUMLIB=1
 TARGET_DIRS_ICONVENC=1
 TARGET_DIRS_GTK2=1
@@ -3654,6 +3675,7 @@ TARGET_DIRS_SDL=1
 TARGET_DIRS_OPENSSL=1
 TARGET_DIRS_GNOME1=1
 TARGET_DIRS_HTTPD22=1
+TARGET_DIRS_HTTPD24=1
 TARGET_DIRS_PXLIB=1
 TARGET_DIRS_NUMLIB=1
 TARGET_DIRS_GMP=1
@@ -3729,6 +3751,7 @@ TARGET_DIRS_GTK1=1
 TARGET_DIRS_GTK2=1
 TARGET_DIRS_LIBRSVG=1
 TARGET_DIRS_HTTPD22=1
+TARGET_DIRS_HTTPD24=1
 TARGET_DIRS_PXLIB=1
 TARGET_DIRS_NUMLIB=1
 TARGET_DIRS_USERS=1
@@ -3804,6 +3827,7 @@ TARGET_DIRS_SDL=1
 TARGET_DIRS_OPENSSL=1
 TARGET_DIRS_GNOME1=1
 TARGET_DIRS_HTTPD22=1
+TARGET_DIRS_HTTPD24=1
 TARGET_DIRS_PXLIB=1
 TARGET_DIRS_NUMLIB=1
 TARGET_DIRS_DBLIB=1
@@ -3870,6 +3894,7 @@ TARGET_DIRS_GGI=1
 TARGET_DIRS_OPENSSL=1
 TARGET_DIRS_GNOME1=1
 TARGET_DIRS_HTTPD22=1
+TARGET_DIRS_HTTPD24=1
 TARGET_DIRS_NUMLIB=1
 TARGET_DIRS_ICONVENC=1
 TARGET_DIRS_GTK2=1
@@ -3943,6 +3968,7 @@ TARGET_DIRS_SDL=1
 TARGET_DIRS_OPENSSL=1
 TARGET_DIRS_GNOME1=1
 TARGET_DIRS_HTTPD22=1
+TARGET_DIRS_HTTPD24=1
 TARGET_DIRS_PXLIB=1
 TARGET_DIRS_NUMLIB=1
 TARGET_DIRS_DBLIB=1
@@ -4015,6 +4041,7 @@ TARGET_DIRS_FPGTK=1
 TARGET_DIRS_XFORMS=1
 TARGET_DIRS_GNOME1=1
 TARGET_DIRS_HTTPD22=1
+TARGET_DIRS_HTTPD24=1
 TARGET_DIRS_IMLIB=1
 TARGET_DIRS_COCOAINT=1
 endif
@@ -4066,6 +4093,7 @@ TARGET_DIRS_SDL=1
 TARGET_DIRS_OPENSSL=1
 TARGET_DIRS_CDROM=1
 TARGET_DIRS_HTTPD22=1
+TARGET_DIRS_HTTPD24=1
 TARGET_DIRS_NUMLIB=1
 TARGET_DIRS_FCL-EXTRA=1
 TARGET_DIRS_OPENCL=1
@@ -4186,6 +4214,7 @@ TARGET_DIRS_SDL=1
 TARGET_DIRS_OPENSSL=1
 TARGET_DIRS_GNOME1=1
 TARGET_DIRS_HTTPD22=1
+TARGET_DIRS_HTTPD24=1
 TARGET_DIRS_PXLIB=1
 TARGET_DIRS_NUMLIB=1
 TARGET_DIRS_GMP=1
@@ -4280,6 +4309,7 @@ TARGET_DIRS_UNIVINT=1
 TARGET_DIRS_DBLIB=1
 TARGET_DIRS_FPINDEXER=1
 TARGET_DIRS_HTTPD22=1
+TARGET_DIRS_HTTPD24=1
 TARGET_DIRS_OPENGLES=1
 TARGET_DIRS_OBJCRTL=1
 endif
@@ -4310,6 +4340,7 @@ TARGET_DIRS_HERMES=1
 TARGET_DIRS_FPPKG=1
 TARGET_DIRS_WINCEUNITS=1
 TARGET_DIRS_HTTPD22=1
+TARGET_DIRS_HTTPD24=1
 TARGET_DIRS_FCL-WEB=1
 TARGET_DIRS_FASTCGI=1
 TARGET_DIRS_TCL=1
@@ -4518,6 +4549,7 @@ TARGET_DIRS_SDL=1
 TARGET_DIRS_OPENSSL=1
 TARGET_DIRS_GNOME1=1
 TARGET_DIRS_HTTPD22=1
+TARGET_DIRS_HTTPD24=1
 TARGET_DIRS_PXLIB=1
 TARGET_DIRS_NUMLIB=1
 TARGET_DIRS_GMP=1
@@ -4594,6 +4626,7 @@ TARGET_DIRS_FPGTK=1
 TARGET_DIRS_XFORMS=1
 TARGET_DIRS_GNOME1=1
 TARGET_DIRS_HTTPD22=1
+TARGET_DIRS_HTTPD24=1
 TARGET_DIRS_IMLIB=1
 TARGET_DIRS_COCOAINT=1
 endif
@@ -4734,6 +4767,7 @@ TARGET_DIRS_SDL=1
 TARGET_DIRS_OPENSSL=1
 TARGET_DIRS_GNOME1=1
 TARGET_DIRS_HTTPD22=1
+TARGET_DIRS_HTTPD24=1
 TARGET_DIRS_PXLIB=1
 TARGET_DIRS_NUMLIB=1
 TARGET_DIRS_GMP=1
@@ -4853,6 +4887,7 @@ TARGET_DIRS_SDL=1
 TARGET_DIRS_OPENSSL=1
 TARGET_DIRS_GNOME1=1
 TARGET_DIRS_HTTPD22=1
+TARGET_DIRS_HTTPD24=1
 TARGET_DIRS_PXLIB=1
 TARGET_DIRS_NUMLIB=1
 TARGET_DIRS_GMP=1
@@ -8596,6 +8631,51 @@ httpd22:
 	$(MAKE) -C httpd22 all
 .PHONY: httpd22_all httpd22_debug httpd22_smart httpd22_release httpd22_units httpd22_examples httpd22_shared httpd22_install httpd22_sourceinstall httpd22_exampleinstall httpd22_distinstall httpd22_zipinstall httpd22_zipsourceinstall httpd22_zipexampleinstall httpd22_zipdistinstall httpd22_clean httpd22_distclean httpd22_cleanall httpd22_info httpd22_makefiles httpd22
 endif
+ifdef TARGET_DIRS_HTTPD24
+httpd24_all:
+	$(MAKE) -C httpd24 all
+httpd24_debug:
+	$(MAKE) -C httpd24 debug
+httpd24_smart:
+	$(MAKE) -C httpd24 smart
+httpd24_release:
+	$(MAKE) -C httpd24 release
+httpd24_units:
+	$(MAKE) -C httpd24 units
+httpd24_examples:
+	$(MAKE) -C httpd24 examples
+httpd24_shared:
+	$(MAKE) -C httpd24 shared
+httpd24_install:
+	$(MAKE) -C httpd24 install
+httpd24_sourceinstall:
+	$(MAKE) -C httpd24 sourceinstall
+httpd24_exampleinstall:
+	$(MAKE) -C httpd24 exampleinstall
+httpd24_distinstall:
+	$(MAKE) -C httpd24 distinstall
+httpd24_zipinstall:
+	$(MAKE) -C httpd24 zipinstall
+httpd24_zipsourceinstall:
+	$(MAKE) -C httpd24 zipsourceinstall
+httpd24_zipexampleinstall:
+	$(MAKE) -C httpd24 zipexampleinstall
+httpd24_zipdistinstall:
+	$(MAKE) -C httpd24 zipdistinstall
+httpd24_clean:
+	$(MAKE) -C httpd24 clean
+httpd24_distclean:
+	$(MAKE) -C httpd24 distclean
+httpd24_cleanall:
+	$(MAKE) -C httpd24 cleanall
+httpd24_info:
+	$(MAKE) -C httpd24 info
+httpd24_makefiles:
+	$(MAKE) -C httpd24 makefiles
+httpd24:
+	$(MAKE) -C httpd24 all
+.PHONY: httpd24_all httpd24_debug httpd24_smart httpd24_release httpd24_units httpd24_examples httpd24_shared httpd24_install httpd24_sourceinstall httpd24_exampleinstall httpd24_distinstall httpd24_zipinstall httpd24_zipsourceinstall httpd24_zipexampleinstall httpd24_zipdistinstall httpd24_clean httpd24_distclean httpd24_cleanall httpd24_info httpd24_makefiles httpd24
+endif
 ifdef TARGET_DIRS_PXLIB
 pxlib_all:
 	$(MAKE) -C pxlib all
@@ -9761,11 +9841,11 @@ fcl-net_smart: fcl-passrc_smart fcl-xml_smart fcl-async_smart
 fcl-net_release: fcl-passrc_release fcl-xml_release fcl-async_release
 fcl-net_shared: fcl-passrc_shared fcl-xml_shared fcl-async_shared
 endif
-fcl-web_all: fpmkunit_all fcl-db_all fcl-xml_all fcl-process_all httpd22_all fastcgi_all fcl-net_all fcl-json_all
-fcl-web_debug: fpmkunit_debug fcl-db_debug fcl-xml_debug fcl-process_debug httpd22_debug fastcgi_debug fcl-net_debug fcl-json_debug
-fcl-web_smart: fpmkunit_smart fcl-db_smart fcl-xml_smart fcl-process_smart httpd22_smart fastcgi_smart fcl-net_smart fcl-json_smart
-fcl-web_release: fpmkunit_release fcl-db_release fcl-xml_release fcl-process_release httpd22_release fastcgi_release fcl-net_release fcl-json_release
-fcl-web_shared: fpmkunit_shared fcl-db_shared fcl-xml_shared fcl-process_shared httpd22_shared fastcgi_shared fcl-net_shared fcl-json_shared
+fcl-web_all: fpmkunit_all fcl-db_all fcl-xml_all fcl-process_all httpd22_all httpd24_all fastcgi_all fcl-net_all fcl-json_all
+fcl-web_debug: fpmkunit_debug fcl-db_debug fcl-xml_debug fcl-process_debug httpd22_debug httpd24_debug fastcgi_debug fcl-net_debug fcl-json_debug
+fcl-web_smart: fpmkunit_smart fcl-db_smart fcl-xml_smart fcl-process_smart httpd22_smart httpd24_smart fastcgi_smart fcl-net_smart fcl-json_smart
+fcl-web_release: fpmkunit_release fcl-db_release fcl-xml_release fcl-process_release httpd22_release httpd24_release fastcgi_release fcl-net_release fcl-json_release
+fcl-web_shared: fpmkunit_shared fcl-db_shared fcl-xml_shared fcl-process_shared httpd22_shared httpd24_shared fastcgi_shared fcl-net_shared fcl-json_shared
 fastcgi_all: fpmkunit_all
 fastcgi_debug: fpmkunit_debug
 fastcgi_smart: fpmkunit_smart

+ 21 - 21
packages/Makefile.fpc

@@ -15,47 +15,47 @@ dirs_arm_linux=graph
 dirs_m68k_linux=graph
 dirs_beos=fv fcl-web fastcgi fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick \
                gdbint libpng x11 gdbm tcl syslog libcurl opengl cairo bfd aspell svgalib \
-               imlib utmp  fpgtk xforms fftw pcap ggi sdl openssl graph gnome1 gtk1 gtk2 librsvg  httpd22 pxlib numlib \
+               imlib utmp  fpgtk xforms fftw pcap ggi sdl openssl graph gnome1 gtk1 gtk2 librsvg  httpd22 httpd24  pxlib numlib \
                iconvenc fpindexer
 dirs_haiku=fv fcl-web fastcgi fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick \
                gdbint libpng x11 gdbm tcl syslog libcurl opengl cairo bfd aspell svgalib \
-               imlib utmp  fpgtk xforms fftw pcap ggi sdl openssl graph gnome1 gtk1 gtk2 librsvg  httpd22 pxlib numlib \
+               imlib utmp  fpgtk xforms fftw pcap ggi sdl openssl graph gnome1 gtk1 gtk2 librsvg  httpd22 httpd24  pxlib numlib \
                iconvenc dblib fpindexer
 dirs_freebsd=fv fcl-web fastcgi fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick \
                gdbint libpng x11 gdbm tcl syslog libcurl opengl cairo  bfd aspell svgalib \
-               imlib utmp  fpgtk xforms fftw pcap ggi sdl openssl graph gnome1 gtk1 gtk2 librsvg  httpd22 pxlib numlib \
+               imlib utmp  fpgtk xforms fftw pcap ggi sdl openssl graph gnome1 gtk1 gtk2 librsvg  httpd22 httpd24  pxlib numlib \
                users iconvenc gmp fcl-extra libxml dblib fpindexer
 dirs_darwin=fv fcl-web fastcgi fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick \
                libpng gdbm tcl syslog libcurl bfd aspell utmp fftw pcap openssl numlib iconvenc gmp fcl-extra univint dblib fpindexer
 dirs_iphonesim=fv fcl-web fastcgi fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick \
                libpng gdbm tcl syslog libcurl bfd aspell utmp fftw pcap openssl numlib iconvenc gmp fcl-extra univint fpindexer
-dirs_i386_darwin=graph sdl opengl x11 cairo gtk1 gtk2 librsvg fpgtk xforms gnome1  httpd22 imlib objcrtl cocoaint opencl openal
-dirs_powerpc_darwin=graph sdl opengl x11 cairo gtk1 gtk2 librsvg fpgtk xforms gnome1  httpd22 imlib objcrtl cocoaint
-dirs_x86_64_darwin=opengl x11 cairo gtk1 gtk2 librsvg fpgtk xforms gnome1  httpd22 imlib cocoaint
-dirs_powerpc64_darwin=opengl x11 cairo gtk1 gtk2 librsvg fpgtk xforms gnome1  httpd22 imlib cocoaint
-dirs_arm_darwin= httpd22 opengles objcrtl
-dirs_i386_iphonesim= httpd22 opengles objcrtl dblib
+dirs_i386_darwin=graph sdl opengl x11 cairo gtk1 gtk2 librsvg fpgtk xforms gnome1  httpd22 httpd24  imlib objcrtl cocoaint opencl openal
+dirs_powerpc_darwin=graph sdl opengl x11 cairo gtk1 gtk2 librsvg fpgtk xforms gnome1  httpd22 httpd24  imlib objcrtl cocoaint
+dirs_x86_64_darwin=opengl x11 cairo gtk1 gtk2 librsvg fpgtk xforms gnome1  httpd22 httpd24  imlib cocoaint
+dirs_powerpc64_darwin=opengl x11 cairo gtk1 gtk2 librsvg fpgtk xforms gnome1  httpd22 httpd24  imlib cocoaint
+dirs_arm_darwin= httpd22 httpd24  opengles objcrtl
+dirs_i386_iphonesim= httpd22 httpd24  opengles objcrtl dblib
 dirs_solaris=fv fcl-web fastcgi fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick \
                libpng x11 gdbm tcl syslog libcurl opengl cairo gtk1 bfd svgalib fcl-extra \
-               imlib utmp  fpgtk xforms fftw pcap ggi  openssl gnome1  httpd22 numlib iconvenc gtk2 cairo dblib fpindexer dblib
+               imlib utmp  fpgtk xforms fftw pcap ggi  openssl gnome1  httpd22 httpd24  numlib iconvenc gtk2 cairo dblib fpindexer dblib
 dirs_netbsd=fv fcl-web fastcgi fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick \
                gdbint libpng x11 gdbm tcl syslog libcurl opengl cairo gtk1 gtk2 librsvg bfd aspell svgalib \
-               imlib utmp  fpgtk xforms fftw pcap ggi sdl openssl gnome1  httpd22 pxlib numlib dblib fpindexer
+               imlib utmp  fpgtk xforms fftw pcap ggi sdl openssl gnome1  httpd22 httpd24  pxlib numlib dblib fpindexer
 dirs_openbsd=fv fcl-web fastcgi fcl-async ibase mysql ncurses zlib oracle odbc  postgres sqlite pthreads imagemagick \
                gdbint libpng x11 gdbm tcl syslog libcurl opengl cairo gtk1 gtk2 librsvg bfd aspell svgalib \
-               imlib utmp  fpgtk xforms fftw pcap ggi sdl openssl gnome1  httpd22 pxlib numlib dblib fpindexer
+               imlib utmp  fpgtk xforms fftw pcap ggi sdl openssl gnome1  httpd22 httpd24  pxlib numlib dblib fpindexer
 dirs_linux=fv fcl-web fastcgi fcl-async ibase mysql ncurses unzip zlib oracle dbus odbc postgres sqlite pthreads imagemagick \
                gdbint libpng x11 uuid ldap modplug dts mad  gdbm tcl syslog libcurl opengl opencl cairo gtk1 gtk2 librsvg \
                a52 bfd aspell svgalib newt cdrom users  iconvenc libxml proj4 fcl-extra zorba \
-               imlib utmp  fpgtk openal lua oggvorbis xforms fftw pcap ggi sdl openssl gnome1  httpd22 \
+               imlib utmp  fpgtk openal lua oggvorbis xforms fftw pcap ggi sdl openssl gnome1  httpd22 httpd24  \
                pxlib numlib gmp libsee ptc dblib fpindexer
 dirs_win32=fv winunits-base winunits-jedi fcl-web fastcgi ibase mysql zlib oracle odbc postgres sqlite imagemagick \
                gdbint libpng mad tcl opengl gtk1 gtk2 librsvg a52 cdrom fpgtk openal fftw lua fcl-extra zorba \
-               oggvorbis sdl openssl graph pcap  httpd22 pxlib numlib winceunits cairo libxml \
+               oggvorbis sdl openssl graph pcap  httpd22 httpd24  pxlib numlib winceunits cairo libxml \
                gmp opencl libsee nvapi ptc aspell dblib fpindexer
 dirs_win64=fv winunits-base winunits-jedi fcl-web fastcgi ibase mysql zlib oracle odbc postgres sqlite imagemagick gdbint \
-                tcl opengl gtk1 fpgtk fftw sdl openssl cdrom  httpd22 numlib fcl-extra opencl nvapi ptc graph dblib fpindexer
-dirs_wince=winceunits httpd22 fcl-web fastcgi tcl fftw unzip zlib sqlite mysql ibase postgres oracle odbc sdl openssl oggvorbis numlib dblib fpindexer
+                tcl opengl gtk1 fpgtk fftw sdl openssl cdrom  httpd22 httpd24  numlib fcl-extra opencl nvapi ptc graph dblib fpindexer
+dirs_wince=winceunits httpd22 httpd24  fcl-web fastcgi tcl fftw unzip zlib sqlite mysql ibase postgres oracle odbc sdl openssl oggvorbis numlib dblib fpindexer
 dirs_os2=fv zlib libpng x11 tcl fpgtk rexx os2units gtk1 imlib
 dirs_emx=fv zlib libpng x11 tcl fpgtk rexx os2units gtk1 imlib
 dirs_netware=fv zlib unzip
@@ -192,11 +192,11 @@ fcl-net_release: fcl-passrc_release fcl-xml_release fcl-async_release
 fcl-net_shared: fcl-passrc_shared fcl-xml_shared fcl-async_shared
 endif
 
-fcl-web_all: fpmkunit_all fcl-db_all fcl-xml_all fcl-process_all httpd22_all fastcgi_all fcl-net_all fcl-json_all
-fcl-web_debug: fpmkunit_debug fcl-db_debug fcl-xml_debug fcl-process_debug httpd22_debug fastcgi_debug fcl-net_debug fcl-json_debug
-fcl-web_smart: fpmkunit_smart fcl-db_smart fcl-xml_smart fcl-process_smart httpd22_smart fastcgi_smart fcl-net_smart fcl-json_smart
-fcl-web_release: fpmkunit_release fcl-db_release fcl-xml_release fcl-process_release httpd22_release fastcgi_release fcl-net_release fcl-json_release
-fcl-web_shared: fpmkunit_shared fcl-db_shared fcl-xml_shared fcl-process_shared httpd22_shared fastcgi_shared fcl-net_shared fcl-json_shared
+fcl-web_all: fpmkunit_all fcl-db_all fcl-xml_all fcl-process_all httpd22_all httpd24_all fastcgi_all fcl-net_all fcl-json_all
+fcl-web_debug: fpmkunit_debug fcl-db_debug fcl-xml_debug fcl-process_debug httpd22_debug httpd24_debug fastcgi_debug fcl-net_debug fcl-json_debug
+fcl-web_smart: fpmkunit_smart fcl-db_smart fcl-xml_smart fcl-process_smart httpd22_smart httpd24_smart fastcgi_smart fcl-net_smart fcl-json_smart
+fcl-web_release: fpmkunit_release fcl-db_release fcl-xml_release fcl-process_release httpd22_release httpd24_release fastcgi_release fcl-net_release fcl-json_release
+fcl-web_shared: fpmkunit_shared fcl-db_shared fcl-xml_shared fcl-process_shared httpd22_shared httpd24_shared fastcgi_shared fcl-net_shared fcl-json_shared
 
 fastcgi_all: fpmkunit_all
 fastcgi_debug: fpmkunit_debug

+ 8 - 1
packages/fcl-web/fpmake.pp

@@ -25,6 +25,7 @@ begin
     P.Dependencies.Add('fcl-process');
     P.Dependencies.Add('fastcgi');
     P.Dependencies.Add('httpd22');
+    P.Dependencies.Add('httpd24');
     // (Temporary) indirect dependencies, not detected by fpcmake:
     P.Dependencies.Add('univint',[MacOSX,iphonesim]);
 
@@ -129,6 +130,12 @@ begin
         Dependencies.AddUnit('custweb');
         ResourceStrings:=true;
       end;
+    with P.Targets.AddUnit('fpapache24.pp') do
+      begin
+        Dependencies.AddUnit('fphttp');
+        Dependencies.AddUnit('custweb');
+        ResourceStrings:=true;
+      end;
     T:=P.Targets.AddUnit('fcgigate.pp');
     T.ResourceStrings:=true;
     With T.Dependencies do
@@ -145,7 +152,7 @@ begin
     T:=P.Targets.AddUnit('fphttpclient.pp');
     T.ResourceStrings:=true;
     T:=P.Targets.AddUnit('custhttpapp.pp');
-    T.ResourceStrings:=true;
+    // T.ResourceStrings:=true;
     T:=P.Targets.AddUnit('fphttpapp.pp');
     T:=P.Targets.AddUnit('fpwebfile.pp');
     T.ResourceStrings:=true;

+ 169 - 66
packages/fcl-web/src/base/Makefile

@@ -290,199 +290,199 @@ override PACKAGE_NAME=fcl-web
 override PACKAGE_VERSION=2.6.3
 PACKAGEDIR_MAIN:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /fcl-web/Makefile.fpc,$(PACKAGESDIR))))))
 ifeq ($(FULL_TARGET),i386-linux)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile  custfcgi fpfcgi
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile fpapache24  custfcgi fpfcgi
 endif
 ifeq ($(FULL_TARGET),i386-go32v2)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile fpapache24
 endif
 ifeq ($(FULL_TARGET),i386-win32)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile  custfcgi fpfcgi
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile fpapache24  custfcgi fpfcgi
 endif
 ifeq ($(FULL_TARGET),i386-os2)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile fpapache24
 endif
 ifeq ($(FULL_TARGET),i386-freebsd)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile  custfcgi fpfcgi
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile fpapache24  custfcgi fpfcgi
 endif
 ifeq ($(FULL_TARGET),i386-beos)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile  custfcgi fpfcgi
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile fpapache24  custfcgi fpfcgi
 endif
 ifeq ($(FULL_TARGET),i386-haiku)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile  custfcgi fpfcgi
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile fpapache24  custfcgi fpfcgi
 endif
 ifeq ($(FULL_TARGET),i386-netbsd)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile  custfcgi fpfcgi
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile fpapache24  custfcgi fpfcgi
 endif
 ifeq ($(FULL_TARGET),i386-solaris)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile  custfcgi fpfcgi
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile fpapache24  custfcgi fpfcgi
 endif
 ifeq ($(FULL_TARGET),i386-qnx)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile fpapache24
 endif
 ifeq ($(FULL_TARGET),i386-netware)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile fpapache24
 endif
 ifeq ($(FULL_TARGET),i386-openbsd)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile  custfcgi fpfcgi
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile fpapache24  custfcgi fpfcgi
 endif
 ifeq ($(FULL_TARGET),i386-wdosx)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile fpapache24
 endif
 ifeq ($(FULL_TARGET),i386-darwin)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile fpapache24
 endif
 ifeq ($(FULL_TARGET),i386-emx)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile fpapache24
 endif
 ifeq ($(FULL_TARGET),i386-watcom)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile fpapache24
 endif
 ifeq ($(FULL_TARGET),i386-netwlibc)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile fpapache24
 endif
 ifeq ($(FULL_TARGET),i386-wince)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile fpapache24
 endif
 ifeq ($(FULL_TARGET),i386-embedded)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile fpapache24
 endif
 ifeq ($(FULL_TARGET),i386-symbian)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile fpapache24
 endif
 ifeq ($(FULL_TARGET),i386-nativent)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile fpapache24
 endif
 ifeq ($(FULL_TARGET),i386-iphonesim)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile fpapache24
 endif
 ifeq ($(FULL_TARGET),m68k-linux)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile  custfcgi fpfcgi
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile fpapache24  custfcgi fpfcgi
 endif
 ifeq ($(FULL_TARGET),m68k-freebsd)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile  custfcgi fpfcgi
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile fpapache24  custfcgi fpfcgi
 endif
 ifeq ($(FULL_TARGET),m68k-netbsd)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile  custfcgi fpfcgi
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile fpapache24  custfcgi fpfcgi
 endif
 ifeq ($(FULL_TARGET),m68k-amiga)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile fpapache24
 endif
 ifeq ($(FULL_TARGET),m68k-atari)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile fpapache24
 endif
 ifeq ($(FULL_TARGET),m68k-openbsd)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile  custfcgi fpfcgi
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile fpapache24  custfcgi fpfcgi
 endif
 ifeq ($(FULL_TARGET),m68k-palmos)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile fpapache24
 endif
 ifeq ($(FULL_TARGET),m68k-embedded)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile fpapache24
 endif
 ifeq ($(FULL_TARGET),powerpc-linux)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile  custfcgi fpfcgi
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile fpapache24  custfcgi fpfcgi
 endif
 ifeq ($(FULL_TARGET),powerpc-netbsd)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile  custfcgi fpfcgi
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile fpapache24  custfcgi fpfcgi
 endif
 ifeq ($(FULL_TARGET),powerpc-amiga)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile fpapache24
 endif
 ifeq ($(FULL_TARGET),powerpc-macos)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile fpapache24
 endif
 ifeq ($(FULL_TARGET),powerpc-darwin)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile fpapache24
 endif
 ifeq ($(FULL_TARGET),powerpc-morphos)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile fpapache24
 endif
 ifeq ($(FULL_TARGET),powerpc-embedded)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile fpapache24
 endif
 ifeq ($(FULL_TARGET),powerpc-wii)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile fpapache24
 endif
 ifeq ($(FULL_TARGET),sparc-linux)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile  custfcgi fpfcgi
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile fpapache24  custfcgi fpfcgi
 endif
 ifeq ($(FULL_TARGET),sparc-netbsd)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile  custfcgi fpfcgi
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile fpapache24  custfcgi fpfcgi
 endif
 ifeq ($(FULL_TARGET),sparc-solaris)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile  custfcgi fpfcgi
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile fpapache24  custfcgi fpfcgi
 endif
 ifeq ($(FULL_TARGET),sparc-embedded)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile fpapache24
 endif
 ifeq ($(FULL_TARGET),x86_64-linux)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile  custfcgi fpfcgi
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile fpapache24  custfcgi fpfcgi
 endif
 ifeq ($(FULL_TARGET),x86_64-freebsd)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile  custfcgi fpfcgi
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile fpapache24  custfcgi fpfcgi
 endif
 ifeq ($(FULL_TARGET),x86_64-netbsd)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile  custfcgi fpfcgi
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile fpapache24  custfcgi fpfcgi
 endif
 ifeq ($(FULL_TARGET),x86_64-solaris)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile  custfcgi fpfcgi
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile fpapache24  custfcgi fpfcgi
 endif
 ifeq ($(FULL_TARGET),x86_64-openbsd)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile  custfcgi fpfcgi
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile fpapache24  custfcgi fpfcgi
 endif
 ifeq ($(FULL_TARGET),x86_64-darwin)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile fpapache24
 endif
 ifeq ($(FULL_TARGET),x86_64-win64)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile  custfcgi fpfcgi
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile fpapache24  custfcgi fpfcgi
 endif
 ifeq ($(FULL_TARGET),x86_64-embedded)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile fpapache24
 endif
 ifeq ($(FULL_TARGET),arm-linux)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile  custfcgi fpfcgi
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile fpapache24  custfcgi fpfcgi
 endif
 ifeq ($(FULL_TARGET),arm-palmos)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile fpapache24
 endif
 ifeq ($(FULL_TARGET),arm-darwin)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile fpapache24
 endif
 ifeq ($(FULL_TARGET),arm-wince)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile fpapache24
 endif
 ifeq ($(FULL_TARGET),arm-gba)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile fpapache24
 endif
 ifeq ($(FULL_TARGET),arm-nds)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile fpapache24
 endif
 ifeq ($(FULL_TARGET),arm-embedded)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile fpapache24
 endif
 ifeq ($(FULL_TARGET),arm-symbian)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile fpapache24
 endif
 ifeq ($(FULL_TARGET),powerpc64-linux)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile  custfcgi fpfcgi
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile fpapache24  custfcgi fpfcgi
 endif
 ifeq ($(FULL_TARGET),powerpc64-darwin)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile fpapache24
 endif
 ifeq ($(FULL_TARGET),powerpc64-embedded)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile fpapache24
 endif
 ifeq ($(FULL_TARGET),avr-embedded)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile fpapache24
 endif
 ifeq ($(FULL_TARGET),armeb-linux)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile  custfcgi fpfcgi
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile fpapache24  custfcgi fpfcgi
 endif
 ifeq ($(FULL_TARGET),armeb-embedded)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile fpapache24
 endif
 ifeq ($(FULL_TARGET),mipsel-linux)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile  custfcgi fpfcgi
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile fpapache24  custfcgi fpfcgi
 endif
 ifeq ($(FULL_TARGET),i386-linux)
 override TARGET_RSTS+=fpcgi fphtml fpweb websession cgiapp fphttpserver fphttpclient
@@ -1499,7 +1499,7 @@ else
 TAROPT=vz
 TAREXT=.tar.gz
 endif
-override REQUIRE_PACKAGES=rtl fcl-base fcl-xml fcl-db fcl-process httpd22 fastcgi fcl-net
+override REQUIRE_PACKAGES=rtl fcl-base fcl-xml fcl-db fcl-process httpd22 fastcgi fcl-net httpd24
 ifeq ($(FULL_TARGET),i386-linux)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_FCL-BASE=1
@@ -1516,6 +1516,7 @@ REQUIRE_PACKAGES_FASTCGI=1
 REQUIRE_PACKAGES_FCL-PASSRC=1
 REQUIRE_PACKAGES_FCL-ASYNC=1
 REQUIRE_PACKAGES_FCL-NET=1
+REQUIRE_PACKAGES_HTTPD24=1
 REQUIRE_PACKAGES_IBASE=1
 REQUIRE_PACKAGES_POSTGRES=1
 REQUIRE_PACKAGES_MYSQL=1
@@ -1540,6 +1541,7 @@ REQUIRE_PACKAGES_FASTCGI=1
 REQUIRE_PACKAGES_FCL-PASSRC=1
 REQUIRE_PACKAGES_FCL-ASYNC=1
 REQUIRE_PACKAGES_FCL-NET=1
+REQUIRE_PACKAGES_HTTPD24=1
 endif
 ifeq ($(FULL_TARGET),i386-win32)
 REQUIRE_PACKAGES_RTL=1
@@ -1556,6 +1558,7 @@ REQUIRE_PACKAGES_FASTCGI=1
 REQUIRE_PACKAGES_FCL-PASSRC=1
 REQUIRE_PACKAGES_FCL-ASYNC=1
 REQUIRE_PACKAGES_FCL-NET=1
+REQUIRE_PACKAGES_HTTPD24=1
 REQUIRE_PACKAGES_IBASE=1
 REQUIRE_PACKAGES_POSTGRES=1
 REQUIRE_PACKAGES_MYSQL=1
@@ -1580,6 +1583,7 @@ REQUIRE_PACKAGES_FASTCGI=1
 REQUIRE_PACKAGES_FCL-PASSRC=1
 REQUIRE_PACKAGES_FCL-ASYNC=1
 REQUIRE_PACKAGES_FCL-NET=1
+REQUIRE_PACKAGES_HTTPD24=1
 endif
 ifeq ($(FULL_TARGET),i386-freebsd)
 REQUIRE_PACKAGES_RTL=1
@@ -1597,6 +1601,7 @@ REQUIRE_PACKAGES_FASTCGI=1
 REQUIRE_PACKAGES_FCL-PASSRC=1
 REQUIRE_PACKAGES_FCL-ASYNC=1
 REQUIRE_PACKAGES_FCL-NET=1
+REQUIRE_PACKAGES_HTTPD24=1
 REQUIRE_PACKAGES_IBASE=1
 REQUIRE_PACKAGES_POSTGRES=1
 REQUIRE_PACKAGES_MYSQL=1
@@ -1622,6 +1627,7 @@ REQUIRE_PACKAGES_FASTCGI=1
 REQUIRE_PACKAGES_FCL-PASSRC=1
 REQUIRE_PACKAGES_FCL-ASYNC=1
 REQUIRE_PACKAGES_FCL-NET=1
+REQUIRE_PACKAGES_HTTPD24=1
 REQUIRE_PACKAGES_IBASE=1
 REQUIRE_PACKAGES_POSTGRES=1
 REQUIRE_PACKAGES_MYSQL=1
@@ -1647,6 +1653,7 @@ REQUIRE_PACKAGES_FASTCGI=1
 REQUIRE_PACKAGES_FCL-PASSRC=1
 REQUIRE_PACKAGES_FCL-ASYNC=1
 REQUIRE_PACKAGES_FCL-NET=1
+REQUIRE_PACKAGES_HTTPD24=1
 REQUIRE_PACKAGES_IBASE=1
 REQUIRE_PACKAGES_POSTGRES=1
 REQUIRE_PACKAGES_MYSQL=1
@@ -1671,6 +1678,7 @@ REQUIRE_PACKAGES_FASTCGI=1
 REQUIRE_PACKAGES_FCL-PASSRC=1
 REQUIRE_PACKAGES_FCL-ASYNC=1
 REQUIRE_PACKAGES_FCL-NET=1
+REQUIRE_PACKAGES_HTTPD24=1
 REQUIRE_PACKAGES_IBASE=1
 REQUIRE_PACKAGES_POSTGRES=1
 REQUIRE_PACKAGES_MYSQL=1
@@ -1695,6 +1703,7 @@ REQUIRE_PACKAGES_FASTCGI=1
 REQUIRE_PACKAGES_FCL-PASSRC=1
 REQUIRE_PACKAGES_FCL-ASYNC=1
 REQUIRE_PACKAGES_FCL-NET=1
+REQUIRE_PACKAGES_HTTPD24=1
 REQUIRE_PACKAGES_IBASE=1
 REQUIRE_PACKAGES_POSTGRES=1
 REQUIRE_PACKAGES_MYSQL=1
@@ -1717,6 +1726,7 @@ REQUIRE_PACKAGES_FASTCGI=1
 REQUIRE_PACKAGES_FCL-PASSRC=1
 REQUIRE_PACKAGES_FCL-ASYNC=1
 REQUIRE_PACKAGES_FCL-NET=1
+REQUIRE_PACKAGES_HTTPD24=1
 endif
 ifeq ($(FULL_TARGET),i386-netware)
 REQUIRE_PACKAGES_RTL=1
@@ -1733,6 +1743,7 @@ REQUIRE_PACKAGES_FASTCGI=1
 REQUIRE_PACKAGES_FCL-PASSRC=1
 REQUIRE_PACKAGES_FCL-ASYNC=1
 REQUIRE_PACKAGES_FCL-NET=1
+REQUIRE_PACKAGES_HTTPD24=1
 endif
 ifeq ($(FULL_TARGET),i386-openbsd)
 REQUIRE_PACKAGES_RTL=1
@@ -1749,6 +1760,7 @@ REQUIRE_PACKAGES_FASTCGI=1
 REQUIRE_PACKAGES_FCL-PASSRC=1
 REQUIRE_PACKAGES_FCL-ASYNC=1
 REQUIRE_PACKAGES_FCL-NET=1
+REQUIRE_PACKAGES_HTTPD24=1
 REQUIRE_PACKAGES_IBASE=1
 REQUIRE_PACKAGES_POSTGRES=1
 REQUIRE_PACKAGES_MYSQL=1
@@ -1773,6 +1785,7 @@ REQUIRE_PACKAGES_FASTCGI=1
 REQUIRE_PACKAGES_FCL-PASSRC=1
 REQUIRE_PACKAGES_FCL-ASYNC=1
 REQUIRE_PACKAGES_FCL-NET=1
+REQUIRE_PACKAGES_HTTPD24=1
 endif
 ifeq ($(FULL_TARGET),i386-darwin)
 REQUIRE_PACKAGES_RTL=1
@@ -1791,6 +1804,7 @@ REQUIRE_PACKAGES_FASTCGI=1
 REQUIRE_PACKAGES_FCL-PASSRC=1
 REQUIRE_PACKAGES_FCL-ASYNC=1
 REQUIRE_PACKAGES_FCL-NET=1
+REQUIRE_PACKAGES_HTTPD24=1
 REQUIRE_PACKAGES_IBASE=1
 REQUIRE_PACKAGES_POSTGRES=1
 REQUIRE_PACKAGES_MYSQL=1
@@ -1813,6 +1827,7 @@ REQUIRE_PACKAGES_FASTCGI=1
 REQUIRE_PACKAGES_FCL-PASSRC=1
 REQUIRE_PACKAGES_FCL-ASYNC=1
 REQUIRE_PACKAGES_FCL-NET=1
+REQUIRE_PACKAGES_HTTPD24=1
 endif
 ifeq ($(FULL_TARGET),i386-watcom)
 REQUIRE_PACKAGES_RTL=1
@@ -1829,6 +1844,7 @@ REQUIRE_PACKAGES_FASTCGI=1
 REQUIRE_PACKAGES_FCL-PASSRC=1
 REQUIRE_PACKAGES_FCL-ASYNC=1
 REQUIRE_PACKAGES_FCL-NET=1
+REQUIRE_PACKAGES_HTTPD24=1
 endif
 ifeq ($(FULL_TARGET),i386-netwlibc)
 REQUIRE_PACKAGES_RTL=1
@@ -1845,6 +1861,7 @@ REQUIRE_PACKAGES_FASTCGI=1
 REQUIRE_PACKAGES_FCL-PASSRC=1
 REQUIRE_PACKAGES_FCL-ASYNC=1
 REQUIRE_PACKAGES_FCL-NET=1
+REQUIRE_PACKAGES_HTTPD24=1
 endif
 ifeq ($(FULL_TARGET),i386-wince)
 REQUIRE_PACKAGES_RTL=1
@@ -1861,6 +1878,7 @@ REQUIRE_PACKAGES_FASTCGI=1
 REQUIRE_PACKAGES_FCL-PASSRC=1
 REQUIRE_PACKAGES_FCL-ASYNC=1
 REQUIRE_PACKAGES_FCL-NET=1
+REQUIRE_PACKAGES_HTTPD24=1
 REQUIRE_PACKAGES_IBASE=1
 REQUIRE_PACKAGES_POSTGRES=1
 REQUIRE_PACKAGES_MYSQL=1
@@ -1883,6 +1901,7 @@ REQUIRE_PACKAGES_FASTCGI=1
 REQUIRE_PACKAGES_FCL-PASSRC=1
 REQUIRE_PACKAGES_FCL-ASYNC=1
 REQUIRE_PACKAGES_FCL-NET=1
+REQUIRE_PACKAGES_HTTPD24=1
 endif
 ifeq ($(FULL_TARGET),i386-symbian)
 REQUIRE_PACKAGES_RTL=1
@@ -1899,6 +1918,7 @@ REQUIRE_PACKAGES_FASTCGI=1
 REQUIRE_PACKAGES_FCL-PASSRC=1
 REQUIRE_PACKAGES_FCL-ASYNC=1
 REQUIRE_PACKAGES_FCL-NET=1
+REQUIRE_PACKAGES_HTTPD24=1
 endif
 ifeq ($(FULL_TARGET),i386-nativent)
 REQUIRE_PACKAGES_RTL=1
@@ -1915,6 +1935,7 @@ REQUIRE_PACKAGES_FASTCGI=1
 REQUIRE_PACKAGES_FCL-PASSRC=1
 REQUIRE_PACKAGES_FCL-ASYNC=1
 REQUIRE_PACKAGES_FCL-NET=1
+REQUIRE_PACKAGES_HTTPD24=1
 endif
 ifeq ($(FULL_TARGET),i386-iphonesim)
 REQUIRE_PACKAGES_RTL=1
@@ -1933,6 +1954,7 @@ REQUIRE_PACKAGES_FASTCGI=1
 REQUIRE_PACKAGES_FCL-PASSRC=1
 REQUIRE_PACKAGES_FCL-ASYNC=1
 REQUIRE_PACKAGES_FCL-NET=1
+REQUIRE_PACKAGES_HTTPD24=1
 REQUIRE_PACKAGES_IBASE=1
 REQUIRE_PACKAGES_POSTGRES=1
 REQUIRE_PACKAGES_MYSQL=1
@@ -1956,6 +1978,7 @@ REQUIRE_PACKAGES_FASTCGI=1
 REQUIRE_PACKAGES_FCL-PASSRC=1
 REQUIRE_PACKAGES_FCL-ASYNC=1
 REQUIRE_PACKAGES_FCL-NET=1
+REQUIRE_PACKAGES_HTTPD24=1
 REQUIRE_PACKAGES_IBASE=1
 REQUIRE_PACKAGES_POSTGRES=1
 REQUIRE_PACKAGES_MYSQL=1
@@ -1981,6 +2004,7 @@ REQUIRE_PACKAGES_FASTCGI=1
 REQUIRE_PACKAGES_FCL-PASSRC=1
 REQUIRE_PACKAGES_FCL-ASYNC=1
 REQUIRE_PACKAGES_FCL-NET=1
+REQUIRE_PACKAGES_HTTPD24=1
 REQUIRE_PACKAGES_IBASE=1
 REQUIRE_PACKAGES_POSTGRES=1
 REQUIRE_PACKAGES_MYSQL=1
@@ -2005,6 +2029,7 @@ REQUIRE_PACKAGES_FASTCGI=1
 REQUIRE_PACKAGES_FCL-PASSRC=1
 REQUIRE_PACKAGES_FCL-ASYNC=1
 REQUIRE_PACKAGES_FCL-NET=1
+REQUIRE_PACKAGES_HTTPD24=1
 REQUIRE_PACKAGES_IBASE=1
 REQUIRE_PACKAGES_POSTGRES=1
 REQUIRE_PACKAGES_MYSQL=1
@@ -2029,6 +2054,7 @@ REQUIRE_PACKAGES_FASTCGI=1
 REQUIRE_PACKAGES_FCL-PASSRC=1
 REQUIRE_PACKAGES_FCL-ASYNC=1
 REQUIRE_PACKAGES_FCL-NET=1
+REQUIRE_PACKAGES_HTTPD24=1
 endif
 ifeq ($(FULL_TARGET),m68k-atari)
 REQUIRE_PACKAGES_RTL=1
@@ -2045,6 +2071,7 @@ REQUIRE_PACKAGES_FASTCGI=1
 REQUIRE_PACKAGES_FCL-PASSRC=1
 REQUIRE_PACKAGES_FCL-ASYNC=1
 REQUIRE_PACKAGES_FCL-NET=1
+REQUIRE_PACKAGES_HTTPD24=1
 endif
 ifeq ($(FULL_TARGET),m68k-openbsd)
 REQUIRE_PACKAGES_RTL=1
@@ -2061,6 +2088,7 @@ REQUIRE_PACKAGES_FASTCGI=1
 REQUIRE_PACKAGES_FCL-PASSRC=1
 REQUIRE_PACKAGES_FCL-ASYNC=1
 REQUIRE_PACKAGES_FCL-NET=1
+REQUIRE_PACKAGES_HTTPD24=1
 REQUIRE_PACKAGES_IBASE=1
 REQUIRE_PACKAGES_POSTGRES=1
 REQUIRE_PACKAGES_MYSQL=1
@@ -2085,6 +2113,7 @@ REQUIRE_PACKAGES_FASTCGI=1
 REQUIRE_PACKAGES_FCL-PASSRC=1
 REQUIRE_PACKAGES_FCL-ASYNC=1
 REQUIRE_PACKAGES_FCL-NET=1
+REQUIRE_PACKAGES_HTTPD24=1
 endif
 ifeq ($(FULL_TARGET),m68k-embedded)
 REQUIRE_PACKAGES_RTL=1
@@ -2101,6 +2130,7 @@ REQUIRE_PACKAGES_FASTCGI=1
 REQUIRE_PACKAGES_FCL-PASSRC=1
 REQUIRE_PACKAGES_FCL-ASYNC=1
 REQUIRE_PACKAGES_FCL-NET=1
+REQUIRE_PACKAGES_HTTPD24=1
 endif
 ifeq ($(FULL_TARGET),powerpc-linux)
 REQUIRE_PACKAGES_RTL=1
@@ -2118,6 +2148,7 @@ REQUIRE_PACKAGES_FASTCGI=1
 REQUIRE_PACKAGES_FCL-PASSRC=1
 REQUIRE_PACKAGES_FCL-ASYNC=1
 REQUIRE_PACKAGES_FCL-NET=1
+REQUIRE_PACKAGES_HTTPD24=1
 REQUIRE_PACKAGES_IBASE=1
 REQUIRE_PACKAGES_POSTGRES=1
 REQUIRE_PACKAGES_MYSQL=1
@@ -2142,6 +2173,7 @@ REQUIRE_PACKAGES_FASTCGI=1
 REQUIRE_PACKAGES_FCL-PASSRC=1
 REQUIRE_PACKAGES_FCL-ASYNC=1
 REQUIRE_PACKAGES_FCL-NET=1
+REQUIRE_PACKAGES_HTTPD24=1
 REQUIRE_PACKAGES_IBASE=1
 REQUIRE_PACKAGES_POSTGRES=1
 REQUIRE_PACKAGES_MYSQL=1
@@ -2166,6 +2198,7 @@ REQUIRE_PACKAGES_FASTCGI=1
 REQUIRE_PACKAGES_FCL-PASSRC=1
 REQUIRE_PACKAGES_FCL-ASYNC=1
 REQUIRE_PACKAGES_FCL-NET=1
+REQUIRE_PACKAGES_HTTPD24=1
 endif
 ifeq ($(FULL_TARGET),powerpc-macos)
 REQUIRE_PACKAGES_RTL=1
@@ -2182,6 +2215,7 @@ REQUIRE_PACKAGES_FASTCGI=1
 REQUIRE_PACKAGES_FCL-PASSRC=1
 REQUIRE_PACKAGES_FCL-ASYNC=1
 REQUIRE_PACKAGES_FCL-NET=1
+REQUIRE_PACKAGES_HTTPD24=1
 endif
 ifeq ($(FULL_TARGET),powerpc-darwin)
 REQUIRE_PACKAGES_RTL=1
@@ -2200,6 +2234,7 @@ REQUIRE_PACKAGES_FASTCGI=1
 REQUIRE_PACKAGES_FCL-PASSRC=1
 REQUIRE_PACKAGES_FCL-ASYNC=1
 REQUIRE_PACKAGES_FCL-NET=1
+REQUIRE_PACKAGES_HTTPD24=1
 REQUIRE_PACKAGES_IBASE=1
 REQUIRE_PACKAGES_POSTGRES=1
 REQUIRE_PACKAGES_MYSQL=1
@@ -2222,6 +2257,7 @@ REQUIRE_PACKAGES_FASTCGI=1
 REQUIRE_PACKAGES_FCL-PASSRC=1
 REQUIRE_PACKAGES_FCL-ASYNC=1
 REQUIRE_PACKAGES_FCL-NET=1
+REQUIRE_PACKAGES_HTTPD24=1
 endif
 ifeq ($(FULL_TARGET),powerpc-embedded)
 REQUIRE_PACKAGES_RTL=1
@@ -2238,6 +2274,7 @@ REQUIRE_PACKAGES_FASTCGI=1
 REQUIRE_PACKAGES_FCL-PASSRC=1
 REQUIRE_PACKAGES_FCL-ASYNC=1
 REQUIRE_PACKAGES_FCL-NET=1
+REQUIRE_PACKAGES_HTTPD24=1
 endif
 ifeq ($(FULL_TARGET),powerpc-wii)
 REQUIRE_PACKAGES_RTL=1
@@ -2254,6 +2291,7 @@ REQUIRE_PACKAGES_FASTCGI=1
 REQUIRE_PACKAGES_FCL-PASSRC=1
 REQUIRE_PACKAGES_FCL-ASYNC=1
 REQUIRE_PACKAGES_FCL-NET=1
+REQUIRE_PACKAGES_HTTPD24=1
 endif
 ifeq ($(FULL_TARGET),sparc-linux)
 REQUIRE_PACKAGES_RTL=1
@@ -2271,6 +2309,7 @@ REQUIRE_PACKAGES_FASTCGI=1
 REQUIRE_PACKAGES_FCL-PASSRC=1
 REQUIRE_PACKAGES_FCL-ASYNC=1
 REQUIRE_PACKAGES_FCL-NET=1
+REQUIRE_PACKAGES_HTTPD24=1
 REQUIRE_PACKAGES_IBASE=1
 REQUIRE_PACKAGES_POSTGRES=1
 REQUIRE_PACKAGES_MYSQL=1
@@ -2295,6 +2334,7 @@ REQUIRE_PACKAGES_FASTCGI=1
 REQUIRE_PACKAGES_FCL-PASSRC=1
 REQUIRE_PACKAGES_FCL-ASYNC=1
 REQUIRE_PACKAGES_FCL-NET=1
+REQUIRE_PACKAGES_HTTPD24=1
 REQUIRE_PACKAGES_IBASE=1
 REQUIRE_PACKAGES_POSTGRES=1
 REQUIRE_PACKAGES_MYSQL=1
@@ -2319,6 +2359,7 @@ REQUIRE_PACKAGES_FASTCGI=1
 REQUIRE_PACKAGES_FCL-PASSRC=1
 REQUIRE_PACKAGES_FCL-ASYNC=1
 REQUIRE_PACKAGES_FCL-NET=1
+REQUIRE_PACKAGES_HTTPD24=1
 REQUIRE_PACKAGES_IBASE=1
 REQUIRE_PACKAGES_POSTGRES=1
 REQUIRE_PACKAGES_MYSQL=1
@@ -2341,6 +2382,7 @@ REQUIRE_PACKAGES_FASTCGI=1
 REQUIRE_PACKAGES_FCL-PASSRC=1
 REQUIRE_PACKAGES_FCL-ASYNC=1
 REQUIRE_PACKAGES_FCL-NET=1
+REQUIRE_PACKAGES_HTTPD24=1
 endif
 ifeq ($(FULL_TARGET),x86_64-linux)
 REQUIRE_PACKAGES_RTL=1
@@ -2358,6 +2400,7 @@ REQUIRE_PACKAGES_FASTCGI=1
 REQUIRE_PACKAGES_FCL-PASSRC=1
 REQUIRE_PACKAGES_FCL-ASYNC=1
 REQUIRE_PACKAGES_FCL-NET=1
+REQUIRE_PACKAGES_HTTPD24=1
 REQUIRE_PACKAGES_IBASE=1
 REQUIRE_PACKAGES_POSTGRES=1
 REQUIRE_PACKAGES_MYSQL=1
@@ -2383,6 +2426,7 @@ REQUIRE_PACKAGES_FASTCGI=1
 REQUIRE_PACKAGES_FCL-PASSRC=1
 REQUIRE_PACKAGES_FCL-ASYNC=1
 REQUIRE_PACKAGES_FCL-NET=1
+REQUIRE_PACKAGES_HTTPD24=1
 REQUIRE_PACKAGES_IBASE=1
 REQUIRE_PACKAGES_POSTGRES=1
 REQUIRE_PACKAGES_MYSQL=1
@@ -2407,6 +2451,7 @@ REQUIRE_PACKAGES_FASTCGI=1
 REQUIRE_PACKAGES_FCL-PASSRC=1
 REQUIRE_PACKAGES_FCL-ASYNC=1
 REQUIRE_PACKAGES_FCL-NET=1
+REQUIRE_PACKAGES_HTTPD24=1
 REQUIRE_PACKAGES_IBASE=1
 REQUIRE_PACKAGES_POSTGRES=1
 REQUIRE_PACKAGES_MYSQL=1
@@ -2431,6 +2476,7 @@ REQUIRE_PACKAGES_FASTCGI=1
 REQUIRE_PACKAGES_FCL-PASSRC=1
 REQUIRE_PACKAGES_FCL-ASYNC=1
 REQUIRE_PACKAGES_FCL-NET=1
+REQUIRE_PACKAGES_HTTPD24=1
 REQUIRE_PACKAGES_IBASE=1
 REQUIRE_PACKAGES_POSTGRES=1
 REQUIRE_PACKAGES_MYSQL=1
@@ -2453,6 +2499,7 @@ REQUIRE_PACKAGES_FASTCGI=1
 REQUIRE_PACKAGES_FCL-PASSRC=1
 REQUIRE_PACKAGES_FCL-ASYNC=1
 REQUIRE_PACKAGES_FCL-NET=1
+REQUIRE_PACKAGES_HTTPD24=1
 REQUIRE_PACKAGES_IBASE=1
 REQUIRE_PACKAGES_POSTGRES=1
 REQUIRE_PACKAGES_MYSQL=1
@@ -2479,6 +2526,7 @@ REQUIRE_PACKAGES_FASTCGI=1
 REQUIRE_PACKAGES_FCL-PASSRC=1
 REQUIRE_PACKAGES_FCL-ASYNC=1
 REQUIRE_PACKAGES_FCL-NET=1
+REQUIRE_PACKAGES_HTTPD24=1
 REQUIRE_PACKAGES_IBASE=1
 REQUIRE_PACKAGES_POSTGRES=1
 REQUIRE_PACKAGES_MYSQL=1
@@ -2501,6 +2549,7 @@ REQUIRE_PACKAGES_FASTCGI=1
 REQUIRE_PACKAGES_FCL-PASSRC=1
 REQUIRE_PACKAGES_FCL-ASYNC=1
 REQUIRE_PACKAGES_FCL-NET=1
+REQUIRE_PACKAGES_HTTPD24=1
 REQUIRE_PACKAGES_IBASE=1
 REQUIRE_PACKAGES_POSTGRES=1
 REQUIRE_PACKAGES_MYSQL=1
@@ -2523,6 +2572,7 @@ REQUIRE_PACKAGES_FASTCGI=1
 REQUIRE_PACKAGES_FCL-PASSRC=1
 REQUIRE_PACKAGES_FCL-ASYNC=1
 REQUIRE_PACKAGES_FCL-NET=1
+REQUIRE_PACKAGES_HTTPD24=1
 endif
 ifeq ($(FULL_TARGET),arm-linux)
 REQUIRE_PACKAGES_RTL=1
@@ -2540,6 +2590,7 @@ REQUIRE_PACKAGES_FASTCGI=1
 REQUIRE_PACKAGES_FCL-PASSRC=1
 REQUIRE_PACKAGES_FCL-ASYNC=1
 REQUIRE_PACKAGES_FCL-NET=1
+REQUIRE_PACKAGES_HTTPD24=1
 REQUIRE_PACKAGES_IBASE=1
 REQUIRE_PACKAGES_POSTGRES=1
 REQUIRE_PACKAGES_MYSQL=1
@@ -2564,6 +2615,7 @@ REQUIRE_PACKAGES_FASTCGI=1
 REQUIRE_PACKAGES_FCL-PASSRC=1
 REQUIRE_PACKAGES_FCL-ASYNC=1
 REQUIRE_PACKAGES_FCL-NET=1
+REQUIRE_PACKAGES_HTTPD24=1
 endif
 ifeq ($(FULL_TARGET),arm-darwin)
 REQUIRE_PACKAGES_RTL=1
@@ -2582,6 +2634,7 @@ REQUIRE_PACKAGES_FASTCGI=1
 REQUIRE_PACKAGES_FCL-PASSRC=1
 REQUIRE_PACKAGES_FCL-ASYNC=1
 REQUIRE_PACKAGES_FCL-NET=1
+REQUIRE_PACKAGES_HTTPD24=1
 REQUIRE_PACKAGES_IBASE=1
 REQUIRE_PACKAGES_POSTGRES=1
 REQUIRE_PACKAGES_MYSQL=1
@@ -2604,6 +2657,7 @@ REQUIRE_PACKAGES_FASTCGI=1
 REQUIRE_PACKAGES_FCL-PASSRC=1
 REQUIRE_PACKAGES_FCL-ASYNC=1
 REQUIRE_PACKAGES_FCL-NET=1
+REQUIRE_PACKAGES_HTTPD24=1
 REQUIRE_PACKAGES_IBASE=1
 REQUIRE_PACKAGES_POSTGRES=1
 REQUIRE_PACKAGES_MYSQL=1
@@ -2626,6 +2680,7 @@ REQUIRE_PACKAGES_FASTCGI=1
 REQUIRE_PACKAGES_FCL-PASSRC=1
 REQUIRE_PACKAGES_FCL-ASYNC=1
 REQUIRE_PACKAGES_FCL-NET=1
+REQUIRE_PACKAGES_HTTPD24=1
 endif
 ifeq ($(FULL_TARGET),arm-nds)
 REQUIRE_PACKAGES_RTL=1
@@ -2642,6 +2697,7 @@ REQUIRE_PACKAGES_FASTCGI=1
 REQUIRE_PACKAGES_FCL-PASSRC=1
 REQUIRE_PACKAGES_FCL-ASYNC=1
 REQUIRE_PACKAGES_FCL-NET=1
+REQUIRE_PACKAGES_HTTPD24=1
 endif
 ifeq ($(FULL_TARGET),arm-embedded)
 REQUIRE_PACKAGES_RTL=1
@@ -2658,6 +2714,7 @@ REQUIRE_PACKAGES_FASTCGI=1
 REQUIRE_PACKAGES_FCL-PASSRC=1
 REQUIRE_PACKAGES_FCL-ASYNC=1
 REQUIRE_PACKAGES_FCL-NET=1
+REQUIRE_PACKAGES_HTTPD24=1
 endif
 ifeq ($(FULL_TARGET),arm-symbian)
 REQUIRE_PACKAGES_RTL=1
@@ -2674,6 +2731,7 @@ REQUIRE_PACKAGES_FASTCGI=1
 REQUIRE_PACKAGES_FCL-PASSRC=1
 REQUIRE_PACKAGES_FCL-ASYNC=1
 REQUIRE_PACKAGES_FCL-NET=1
+REQUIRE_PACKAGES_HTTPD24=1
 endif
 ifeq ($(FULL_TARGET),powerpc64-linux)
 REQUIRE_PACKAGES_RTL=1
@@ -2691,6 +2749,7 @@ REQUIRE_PACKAGES_FASTCGI=1
 REQUIRE_PACKAGES_FCL-PASSRC=1
 REQUIRE_PACKAGES_FCL-ASYNC=1
 REQUIRE_PACKAGES_FCL-NET=1
+REQUIRE_PACKAGES_HTTPD24=1
 REQUIRE_PACKAGES_IBASE=1
 REQUIRE_PACKAGES_POSTGRES=1
 REQUIRE_PACKAGES_MYSQL=1
@@ -2717,6 +2776,7 @@ REQUIRE_PACKAGES_FASTCGI=1
 REQUIRE_PACKAGES_FCL-PASSRC=1
 REQUIRE_PACKAGES_FCL-ASYNC=1
 REQUIRE_PACKAGES_FCL-NET=1
+REQUIRE_PACKAGES_HTTPD24=1
 REQUIRE_PACKAGES_IBASE=1
 REQUIRE_PACKAGES_POSTGRES=1
 REQUIRE_PACKAGES_MYSQL=1
@@ -2739,6 +2799,7 @@ REQUIRE_PACKAGES_FASTCGI=1
 REQUIRE_PACKAGES_FCL-PASSRC=1
 REQUIRE_PACKAGES_FCL-ASYNC=1
 REQUIRE_PACKAGES_FCL-NET=1
+REQUIRE_PACKAGES_HTTPD24=1
 endif
 ifeq ($(FULL_TARGET),avr-embedded)
 REQUIRE_PACKAGES_RTL=1
@@ -2755,6 +2816,7 @@ REQUIRE_PACKAGES_FASTCGI=1
 REQUIRE_PACKAGES_FCL-PASSRC=1
 REQUIRE_PACKAGES_FCL-ASYNC=1
 REQUIRE_PACKAGES_FCL-NET=1
+REQUIRE_PACKAGES_HTTPD24=1
 endif
 ifeq ($(FULL_TARGET),armeb-linux)
 REQUIRE_PACKAGES_RTL=1
@@ -2772,6 +2834,7 @@ REQUIRE_PACKAGES_FASTCGI=1
 REQUIRE_PACKAGES_FCL-PASSRC=1
 REQUIRE_PACKAGES_FCL-ASYNC=1
 REQUIRE_PACKAGES_FCL-NET=1
+REQUIRE_PACKAGES_HTTPD24=1
 REQUIRE_PACKAGES_IBASE=1
 REQUIRE_PACKAGES_POSTGRES=1
 REQUIRE_PACKAGES_MYSQL=1
@@ -2796,6 +2859,7 @@ REQUIRE_PACKAGES_FASTCGI=1
 REQUIRE_PACKAGES_FCL-PASSRC=1
 REQUIRE_PACKAGES_FCL-ASYNC=1
 REQUIRE_PACKAGES_FCL-NET=1
+REQUIRE_PACKAGES_HTTPD24=1
 endif
 ifeq ($(FULL_TARGET),mipsel-linux)
 REQUIRE_PACKAGES_RTL=1
@@ -2813,6 +2877,7 @@ REQUIRE_PACKAGES_FASTCGI=1
 REQUIRE_PACKAGES_FCL-PASSRC=1
 REQUIRE_PACKAGES_FCL-ASYNC=1
 REQUIRE_PACKAGES_FCL-NET=1
+REQUIRE_PACKAGES_HTTPD24=1
 REQUIRE_PACKAGES_IBASE=1
 REQUIRE_PACKAGES_POSTGRES=1
 REQUIRE_PACKAGES_MYSQL=1
@@ -3392,6 +3457,44 @@ ifdef UNITDIR_FPMAKE_FCL-NET
 override COMPILER_FPMAKE_UNITDIR+=$(UNITDIR_FPMAKE_FCL-NET)
 endif
 endif
+ifdef REQUIRE_PACKAGES_HTTPD24
+PACKAGEDIR_HTTPD24:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /httpd24/Makefile.fpc,$(PACKAGESDIR))))))
+ifneq ($(PACKAGEDIR_HTTPD24),)
+ifneq ($(wildcard $(PACKAGEDIR_HTTPD24)/units/$(TARGETSUFFIX)),)
+UNITDIR_HTTPD24=$(PACKAGEDIR_HTTPD24)/units/$(TARGETSUFFIX)
+else
+UNITDIR_HTTPD24=$(PACKAGEDIR_HTTPD24)
+endif
+ifneq ($(wildcard $(PACKAGEDIR_HTTPD24)/units/$(SOURCESUFFIX)),)
+UNITDIR_FPMAKE_HTTPD24=$(PACKAGEDIR_HTTPD24)/units/$(SOURCESUFFIX)
+else
+ifneq ($(wildcard $(PACKAGEDIR_HTTPD24)/units_bs/$(SOURCESUFFIX)),)
+UNITDIR_FPMAKE_HTTPD24=$(PACKAGEDIR_HTTPD24)/units_bs/$(SOURCESUFFIX)
+else
+UNITDIR_FPMAKE_HTTPD24=$(PACKAGEDIR_HTTPD24)
+endif
+endif
+ifdef CHECKDEPEND
+$(PACKAGEDIR_HTTPD24)/$(FPCMADE):
+	$(MAKE) -C $(PACKAGEDIR_HTTPD24) $(FPCMADE)
+override ALLDEPENDENCIES+=$(PACKAGEDIR_HTTPD24)/$(FPCMADE)
+endif
+else
+PACKAGEDIR_HTTPD24=
+UNITDIR_HTTPD24:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /httpd24/Package.fpc,$(UNITSDIR)))))
+ifneq ($(UNITDIR_HTTPD24),)
+UNITDIR_HTTPD24:=$(firstword $(UNITDIR_HTTPD24))
+else
+UNITDIR_HTTPD24=
+endif
+endif
+ifdef UNITDIR_HTTPD24
+override COMPILER_UNITDIR+=$(UNITDIR_HTTPD24)
+endif
+ifdef UNITDIR_FPMAKE_HTTPD24
+override COMPILER_FPMAKE_UNITDIR+=$(UNITDIR_FPMAKE_HTTPD24)
+endif
+endif
 ifdef REQUIRE_PACKAGES_IBASE
 PACKAGEDIR_IBASE:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /ibase/Makefile.fpc,$(PACKAGESDIR))))))
 ifneq ($(PACKAGEDIR_IBASE),)

+ 2 - 2
packages/fcl-web/src/base/Makefile.fpc

@@ -9,7 +9,7 @@ version=2.6.3
 [target]
 units=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb \
       webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver \
-      fphttpclient custhttpapp fphttpapp fpwebfile
+      fphttpclient custhttpapp fphttpapp fpwebfile fpapache24
 rsts=fpcgi fphtml fpweb websession cgiapp fphttpserver fphttpclient
 
 # these units are listed separately because they don't work for
@@ -25,7 +25,7 @@ units_win32=custfcgi fpfcgi
 units_win64=custfcgi fpfcgi
 
 [require]
-packages=fcl-base fcl-xml fcl-db fcl-process httpd22 fastcgi fcl-net
+packages=fcl-base fcl-xml fcl-db fcl-process httpd22 fastcgi fcl-net httpd24
 packages_darwin=univint
 packages_iphonesim=univint
 

+ 781 - 0
packages/fcl-web/src/base/fpapache24.pp

@@ -0,0 +1,781 @@
+{
+    $Id: header,v 1.1 2000/07/13 06:33:45 michael Exp $
+    This file is part of the Free Component Library (FCL)
+    Copyright (c) 1999-2000 by the Free Pascal development team
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ **********************************************************************}
+{$mode objfpc}
+{$H+}
+unit fpapache24;
+
+interface
+
+uses
+  SysUtils, Classes, CustWeb, httpDefs, fpHTTP, httpd24, apr24, SyncObjs;
+
+Type
+
+  TApacheHandler = Class;
+
+  { TApacheRequest }
+
+  TApacheRequest = Class(TRequest)
+  Private
+    FApache : TApacheHandler;
+    FRequest : PRequest_rec;
+  Protected
+    Function GetFieldValue(Index : Integer) : String; override;
+    Procedure InitFromRequest;
+    procedure ReadContent; override;
+  Public
+    Constructor CreateReq(App : TApacheHandler; ARequest : PRequest_rec);
+    Property ApacheRequest : Prequest_rec Read FRequest;
+    Property ApacheApp : TApacheHandler Read FApache;
+  end;
+
+  { TApacheResponse }
+
+  TApacheResponse = Class(TResponse)
+  private
+    FApache : TApacheHandler;
+    FRequest : PRequest_rec;
+    procedure SendStream(S: TStream);
+  Protected
+    Procedure DoSendHeaders(Headers : TStrings); override;
+    Procedure DoSendContent; override;
+  Public
+    Constructor CreateApache(Req : TApacheRequest);
+    Property ApacheRequest : Prequest_rec Read FRequest;
+    Property ApacheApp : TApacheHandler Read FApache;
+  end;
+
+  { TCustomApacheApplication }
+  THandlerPriority = (hpFirst,hpMiddle,hpLast);
+  TBeforeRequestEvent = Procedure(Sender : TObject; Const AHandler : String;
+                                  Var AllowRequest : Boolean) of object;
+
+  TApacheHandler = Class(TWebHandler)
+  private
+    FMaxRequests: Integer;             //Maximum number of simultaneous web module requests (default=64, if set to zero no limit)
+    FWorkingWebModules: TList;         //List of currently running web modules handling requests
+    FIdleWebModules: TList;            //List of idle web modules available
+    FCriticalSection: TCriticalSection;
+    FBaseLocation: String;
+    FBeforeRequest: TBeforeRequestEvent;
+    FHandlerName: String;
+    FModuleName: String;
+    FModules : Array[0..1] of TStrings;
+    FPriority: THandlerPriority;
+    FModuleRecord : PModule;
+    function GetModules(Index: integer): TStrings;
+    procedure SetModules(Index: integer; const AValue: TStrings);
+    function GetIdleModuleCount : Integer;
+    function GetWorkingModuleCount : Integer;
+  Protected
+    Function ProcessRequest(P : PRequest_Rec) : Integer; virtual;
+    function WaitForRequest(out ARequest : TRequest; out AResponse : TResponse) : boolean; override;
+    Function AllowRequest(P : PRequest_Rec) : Boolean; virtual;
+    function GetApplicationURL(ARequest : TRequest): String; override;
+  Public
+    Constructor Create(AOwner : TComponent); override;
+    Destructor Destroy; override;
+    Procedure Run; override;
+    Procedure SetModuleRecord(Var ModuleRecord : Module);
+    Procedure Initialize;
+    Procedure LogErrorMessage(Msg : String; LogLevel : integer = APLOG_INFO); virtual;
+    Procedure handleRequest(ARequest : TRequest; AResponse : TResponse); override;
+    Property HandlerPriority : THandlerPriority Read FPriority Write FPriority default hpMiddle;
+    Property BeforeModules : TStrings Index 0 Read GetModules Write SetModules;
+    Property AfterModules : TStrings Index 1 Read GetModules Write SetModules;
+    Property BaseLocation : String Read FBaseLocation Write FBaseLocation;
+    Property ModuleName : String Read FModuleName Write FModuleName;
+    Property HandlerName : String Read FHandlerName Write FHandlerName;
+    Property BeforeRequest : TBeforeRequestEvent Read FBeforeRequest Write FBeforeRequest;
+    Property MaxRequests: Integer read FMaxRequests write FMaxRequests;
+    Property IdleWebModuleCount: Integer read GetIdleModuleCount;
+    Property WorkingWebModuleCount: Integer read GetWorkingModuleCount;
+  end;
+
+  TCustomApacheApplication = Class(TCustomWebApplication)
+  private
+    function GetAfterModules: TStrings;
+    function GetBaseLocation: String;
+    function GetBeforeModules: TStrings;
+    function GetBeforeRequest: TBeforeRequestEvent;
+    function GetHandlerName: String;
+    function GetIdleModuleCount: Integer;
+    function GetMaxRequests: Integer;
+    function GetModuleName: String;
+    function GetPriority: THandlerPriority;
+    function GetWorkingModuleCount: Integer;
+    procedure SetAfterModules(const AValue: TStrings);
+    procedure SetBaseLocation(const AValue: String);
+    procedure SetBeforeModules(const AValue: TStrings);
+    procedure SetBeforeRequest(const AValue: TBeforeRequestEvent);
+    procedure SetHandlerName(const AValue: String);
+    procedure SetMaxRequests(const AValue: Integer);
+    procedure SetModuleName(const AValue: String);
+    procedure SetPriority(const AValue: THandlerPriority);
+  public
+    function InitializeWebHandler: TWebHandler; override;
+    Procedure Initialize;override;
+    procedure ShowException(E: Exception); override;
+    Function ProcessRequest(P : PRequest_Rec) : Integer; virtual;
+    Function AllowRequest(P : PRequest_Rec) : Boolean; virtual;
+    Procedure SetModuleRecord(Var ModuleRecord : Module);
+    Property HandlerPriority : THandlerPriority Read GetPriority Write SetPriority default hpMiddle;
+    Property BeforeModules : TStrings Read GetBeforeModules Write SetBeforeModules;
+    Property AfterModules : TStrings Read GetAfterModules Write SetAfterModules;
+    Property BaseLocation : String Read GetBaseLocation Write SetBaseLocation;
+    Property ModuleName : String Read GetModuleName Write SetModuleName;
+    Property HandlerName : String Read GetHandlerName Write SetHandlerName;
+    Property BeforeRequest : TBeforeRequestEvent Read GetBeforeRequest Write SetBeforeRequest;
+    Property MaxRequests: Integer read GetMaxRequests write SetMaxRequests;
+    Property IdleWebModuleCount: Integer read GetIdleModuleCount;
+    Property WorkingWebModuleCount: Integer read GetWorkingModuleCount;
+  end;
+
+  TApacheApplication = Class(TCustomApacheApplication)
+  Public
+    Property HandlerPriority;
+    Property BeforeModules;
+    Property AfterModules;
+    Property AllowDefaultModule;
+    Property OnGetModule;
+    Property BaseLocation;
+    Property ModuleName;
+    Property MaxRequests;
+    Property IdleWebModuleCount;
+    Property WorkingWebModuleCount;
+  end;
+  
+
+  EFPApacheError = Class(Exception);
+  
+Var
+  Application : TCustomApacheApplication = Nil;
+  ShowCleanUpErrors : Boolean = False;
+  AlternateHandler : ap_hook_handler_t = Nil;
+
+Implementation
+
+uses CustApp;
+
+resourcestring
+  SErrNoModuleNameForRequest = 'Could not determine HTTP module name for request';
+  SErrNoModuleForRequest = 'Could not determine HTTP module for request "%s"';
+  SErrNoModuleRecord = 'No module record location set.';
+  SErrNoModuleName = 'No module name set';
+  SErrTooManyRequests = 'Too many simultaneous requests.';
+
+const
+  HPRIO : Array[THandlerPriority] of Integer
+        = (APR_HOOK_FIRST,APR_HOOK_MIDDLE,APR_HOOK_LAST);
+
+
+Procedure InitApache;
+
+begin
+  Application:=TCustomApacheApplication.Create(Nil);
+  if not assigned(CustomApplication) then
+    CustomApplication := Application;
+end;
+
+Procedure DoneApache;
+
+begin
+  Try
+    if CustomApplication=Application then
+      CustomApplication := nil;
+    FreeAndNil(Application);
+  except
+    if ShowCleanUpErrors then
+      Raise;
+  end;
+end;
+
+Function DefaultApacheHandler(P : PRequest_Rec) : integer;cdecl;
+
+begin
+  If (AlternateHandler<>Nil) then
+    Result:=AlternateHandler(P)
+  else
+    If Application.AllowRequest(P) then
+      Result:=Application.ProcessRequest(P)
+    else
+      Result:=DECLINED;
+end;
+
+Procedure RegisterApacheHooks(P: PApr_pool_t);cdecl;
+
+Var
+  H : ap_hook_handler_t;
+  PP1,PP2 : PPChar;
+
+begin
+  H:=AlternateHandler;
+  If (H=Nil) then
+    H:=@DefaultApacheHandler;
+  PP1:=Nil;
+  PP2:=Nil;
+  ap_hook_handler(H,PP1,PP2,HPRIO[Application.HandlerPriority]);
+end;
+
+{ TApacheHandler }
+
+function TApacheHandler.GetModules(Index: integer): TStrings;
+begin
+  If (FModules[Index]=Nil) then
+    FModules[Index]:=TStringList.Create;
+  Result:=FModules[Index];
+end;
+
+procedure TApacheHandler.SetModules(Index: integer;
+  const AValue: TStrings);
+begin
+  If (FModules[Index]=Nil) then
+    FModules[Index]:=TStringList.Create;
+  FModules[Index].Assign(AValue);
+end;
+
+Function TApacheHandler.ProcessRequest(P: PRequest_Rec) : Integer;
+
+Var
+  Req : TApacheRequest;
+  Resp : TApacheResponse;
+
+begin
+  Req:=TApacheRequest.CreateReq(Self,P);
+  Try
+    InitRequest(Req);
+    Req.InitRequestVars;
+    Resp:=TApacheResponse.CreateApache(Req);
+    Try
+      InitResponse(Resp);
+      HandleRequest(Req,Resp);
+      If Not Resp.ContentSent then
+        Resp.SendContent;
+    Finally
+      Result:=OK;
+      Resp.Free;
+    end;
+  Finally
+    Req.Free;
+  end;
+end;
+
+procedure TApacheHandler.Run;
+begin
+  // Do nothing. This is a library
+  Initialize;
+end;
+
+function TApacheHandler.WaitForRequest(out ARequest: TRequest; out AResponse: TResponse): boolean;
+begin
+  Result:=False;
+  ARequest:=Nil;
+  AResponse:=Nil;
+end;
+
+function TApacheHandler.AllowRequest(P: PRequest_Rec): Boolean;
+
+Var
+  Hn : String;
+
+begin
+  HN:=StrPas(p^.Handler);
+  Result:=CompareText(HN,FHandlerName)=0;
+  If Assigned(FBeforeRequest) then
+    FBeforeRequest(Self,HN,Result);
+end;
+
+function TApacheHandler.GetApplicationURL(ARequest: TRequest): String;
+begin
+  Result:=inherited GetApplicationURL(ARequest);
+  If (Result='') then
+    Result:=BaseLocation;
+end;
+
+constructor TApacheHandler.Create(AOwner: TComponent);
+begin
+  inherited Create(AOwner);
+  FPriority:=hpMiddle;
+  FMaxRequests:=64;
+  FWorkingWebModules:=TList.Create;
+  FIdleWebModules:=TList.Create;
+  FCriticalSection:=TCriticalSection.Create;
+end;
+
+destructor TApacheHandler.Destroy;
+var I:Integer;
+begin
+  FCriticalSection.Free;
+  for I := FIdleWebModules.Count - 1 downto 0 do
+    TComponent(FIdleWebModules[I]).Free;
+  FIdleWebModules.Free;
+  for I := FWorkingWebModules.Count - 1 downto 0 do
+    TComponent(FWorkingWebModules[I]).Free;
+  FWorkingWebModules.Free;
+  inherited Destroy;
+end;
+
+
+procedure TApacheHandler.SetModuleRecord(var ModuleRecord: Module);
+begin
+  FModuleRecord:=@ModuleRecord;
+  FillChar(ModuleRecord,SizeOf(ModuleRecord),0);
+end;
+
+procedure TApacheHandler.Initialize;
+
+begin
+  If (FModuleRecord=nil) then
+    Raise EFPApacheError.Create(SErrNoModuleRecord);
+  if (FModuleName='') and (FModuleRecord^.Name=Nil) then
+    Raise EFPApacheError.Create(SErrNoModuleName);
+  STANDARD20_MODULE_STUFF(FModuleRecord^);
+  If (StrPas(FModuleRecord^.name)<>FModuleName) then
+    FModuleRecord^.Name:=PChar(FModuleName);
+  FModuleRecord^.register_hooks:=@RegisterApacheHooks;
+end;
+
+procedure TApacheHandler.LogErrorMessage(Msg: String; LogLevel: integer);
+var a: ap_version_t;
+begin
+  ap_log_error(pchar(FModuleName),  //The file in which this function is called
+               0,                   //The line number on which this function is called
+               0,                   //The module_index of the module generating this message
+               LogLevel,            //The level of this error message
+               0,                   //The status code from the previous command
+               Nil,                 //The server on which we are logging
+               'module: %s',        //The format string
+               [pchar(Msg)])        //The arguments to use to fill out fmt.
+end;
+
+function TApacheHandler.GetIdleModuleCount : Integer;
+begin
+  FCriticalSection.Enter;
+  try
+    Result := FIdleWebModules.Count;
+  finally
+    FCriticalSection.Leave;
+  end;
+end;
+
+function TApacheHandler.GetWorkingModuleCount : Integer;
+begin
+  FCriticalSection.Enter;
+  try
+    Result := FWorkingWebModules.Count;
+  finally
+    FCriticalSection.Leave;
+  end;
+end;
+
+procedure TApacheHandler.HandleRequest(ARequest: TRequest; AResponse: TResponse);
+
+Var
+  MC : TCustomHTTPModuleClass;
+  M  : TCustomHTTPModule;
+  MN : String;
+  MI : TModuleItem;
+
+  Procedure GetAWebModule;
+  Var II:Integer;
+  begin
+    FCriticalSection.Enter;
+    try
+      if (FMaxRequests>0) and (FWorkingWebModules.Count>=FMaxRequests) then
+        Raise EFPApacheError.Create(SErrTooManyRequests);
+      if (FIdleWebModules.Count>0) then
+      begin
+        II := FIdleWebModules.Count - 1;
+        while (II>=0) and not (TComponent(FIdleWebModules[II]) is MC) do
+          Dec(II);
+        if (II>=0) then
+        begin
+          M:=TCustomHTTPModule(FIdleWebModules[II]);
+          FIdleWebModules.Delete(II);
+        end;
+      end;
+      if (M=nil) then
+      begin
+        M:=MC.Create(Self);
+        M.Name := '';
+      end;
+      FWorkingWebModules.Add(M);
+    finally
+      FCriticalSection.Leave;
+    end;
+  end;
+
+begin
+  try
+    MC:=Nil;
+    M := Nil;
+    If (OnGetModule<>Nil) then
+      OnGetModule(Self,ARequest,MC);
+    If (MC=Nil) then
+    begin
+      MN:=GetModuleName(ARequest);
+      If (MN='') and Not AllowDefaultModule then
+        Raise EFPApacheError.Create(SErrNoModuleNameForRequest);
+      MI:=ModuleFactory.FindModule(MN);
+      If (MI=Nil) and (ModuleFactory.Count=1) then
+        MI:=ModuleFactory[0];
+      if (MI=Nil) then
+        Raise EFPApacheError.CreateFmt(SErrNoModuleForRequest,[MN]);
+
+      MC:=MI.ModuleClass;
+    end;
+    GetAWebModule;
+    M.HandleRequest(ARequest,AResponse);
+
+    FCriticalSection.Enter;
+    try
+      FWorkingWebModules.Remove(M);
+      FIdleWebModules.Add(M);
+    finally
+      FCriticalSection.Leave;
+    end;
+  except
+    On E : Exception do
+      begin
+      LogErrorMessage(E.Message,APLOG_ERR);
+      ShowRequestException(AResponse,E);
+      end;
+  end;
+end;
+
+{ TApacheRequest }
+
+function TApacheRequest.GetFieldValue(Index: Integer): String;
+
+  Function MaybeP(P : Pchar) : String;
+  
+  begin
+    If (P<>Nil) then
+      Result:=StrPas(P);
+  end;
+
+var
+  FN : String;
+  I : Integer;
+  
+begin
+  Result:='';
+  If (Index in [1..NoHTTPFields]) then
+    begin
+    FN:=HTTPFieldNames[Index];
+    Result:=MaybeP(apr_table_get(FRequest^.headers_in,pchar(FN)));
+    end;
+  if (Result='') and Assigned(FRequest) then
+    case Index of
+      0  : Result:=MaybeP(FRequest^.protocol); // ProtocolVersion
+      7  : Result:=MaybeP(FRequest^.content_encoding); //ContentEncoding
+      25 : Result:=MaybeP(FRequest^.path_info); // PathInfo
+      26 : Result:=MaybeP(FRequest^.filename); // PathTranslated
+      27 : // RemoteAddr
+           If (FRequest^.Connection<>Nil) then
+             Result:=MaybeP(FRequest^.Connection^.remote_ip);
+      28 : // RemoteHost
+           If (FRequest^.Connection<>Nil) then
+             begin
+             Result:=MaybeP(ap_get_remote_host(FRequest^.Connection,
+                            FRequest^.per_dir_config,
+//                            nil,
+                            REMOTE_NAME,@i));
+             end;                   
+      29 : begin // ScriptName
+           Result:=MaybeP(FRequest^.unparsed_uri);
+           I:=Pos('?',Result)-1;
+           If (I=-1) then
+             I:=Length(Result);
+           Result:=Copy(Result,1,I-Length(PathInfo));
+           end;
+      30 : Result:=IntToStr(ap_get_server_port(FRequest)); // ServerPort
+      31 : Result:=MaybeP(FRequest^.method); // Method
+      32 : Result:=MaybeP(FRequest^.unparsed_uri); // URL
+      33 : Result:=MaybeP(FRequest^.args); // Query
+      34 : Result:=MaybeP(FRequest^.HostName); // Host
+    else
+      Result:=inherited GetFieldValue(Index);
+    end;
+end;
+
+procedure TApacheRequest.ReadContent;
+
+  Function MinS(A,B : Integer) : Integer;
+  
+  begin
+    If A<B then
+      Result:=A
+    else
+      Result:=B;
+  end;
+
+Var
+  Left,Len,Count,Bytes : Integer;
+  P : Pchar;
+  
+begin
+  ap_setup_client_block(FRequest,REQUEST_CHUNKED_DECHUNK);
+  If (ap_should_client_block(FRequest)=1) then
+    begin
+    Len:=ContentLength;
+    If (Len>0) then
+      begin
+      SetLength(FContent,Len);
+      P:=PChar(FContent);
+      Left:=Len;
+      Count:=0;
+      Repeat
+        Bytes:=ap_get_client_block(FRequest,P,MinS(10*1024,Left));
+        Dec(Left,Bytes);
+        Inc(P,Bytes);
+        Inc(Count,Bytes);
+      Until (Count>=Len) or (Bytes=0);
+      SetLength(FContent,Count);
+      end;
+    end;
+  FContentRead:=True;
+end;
+
+procedure TApacheRequest.InitFromRequest;
+begin
+  ParseCookies;
+end;
+
+Constructor TApacheRequest.CreateReq(App : TApacheHandler; ARequest : PRequest_rec);
+
+begin
+  FApache:=App;
+  FRequest:=Arequest;
+  ReturnedPathInfo:=App.BaseLocation;
+  Inherited Create;
+  InitFromRequest;
+end;
+
+{ TApacheResponse }
+
+procedure TApacheResponse.DoSendHeaders(Headers: TStrings);
+
+Var
+  I,P : Integer;
+  N,V : String;
+
+begin
+  For I:=0 to Headers.Count-1 do
+    begin
+    V:=Headers[i];
+    P:=Pos(':',V);
+    If (P<>0) and (P<Length(V)) then
+      begin
+      N:=Copy(V,1,P-1);
+      System.Delete(V,1,P);
+      V := Trim(V);//no need space before the value, apache puts it there
+      apr_table_set(FRequest^.headers_out,Pchar(N),Pchar(V));
+      end;
+    end;
+end;
+
+procedure TApacheResponse.DoSendContent;
+
+Var
+  S : String;
+  I : Integer;
+
+begin
+  S:=ContentType;
+  If (S<>'') then
+    FRequest^.content_type:=apr_pstrdup(FRequest^.pool,Pchar(S));
+  S:=ContentEncoding;
+  If (S<>'') then
+    FRequest^.content_encoding:=apr_pstrdup(FRequest^.pool,Pchar(S));
+  If Code <> 200 then
+    FRequest^.status := Code;
+  If assigned(ContentStream) then
+    SendStream(Contentstream)
+  else
+    for I:=0 to Contents.Count-1 do
+      begin
+      S:=Contents[i]+LineEnding;
+      // If there is a null, it's written also with ap_rwrite
+      ap_rwrite(PChar(S),Length(S),FRequest);
+      end;
+end;
+
+Procedure TApacheResponse.SendStream(S : TStream);
+
+Var
+  Buf : Array[0..(10*1024)-1] of Byte;
+  Count : Integer;
+
+begin
+  S.Seek(0,soBeginning);
+  Repeat
+    Count:=S.Read(Buf,SizeOf(Buf));
+    If Count>0 then
+      ap_rwrite(@Buf,Count,FRequest);
+  Until (Count=0);
+end;
+
+
+Constructor TApacheResponse.CreateApache(Req : TApacheRequest);
+begin
+  FApache:=Req.ApacheApp;
+  Frequest:=Req.ApacheRequest;
+  Inherited Create(Req);
+end;
+
+function __dummythread(p: pointer): ptrint;
+begin
+  sleep(1000);
+  Result:=0;
+end;
+
+{ TCustomApacheApplication }
+
+function TCustomApacheApplication.GetAfterModules: TStrings;
+begin
+  result := TApacheHandler(WebHandler).AfterModules;
+end;
+
+function TCustomApacheApplication.GetBaseLocation: String;
+begin
+  result := TApacheHandler(WebHandler).BaseLocation;
+end;
+
+function TCustomApacheApplication.GetBeforeModules: TStrings;
+begin
+  result := TApacheHandler(WebHandler).BeforeModules;
+end;
+
+function TCustomApacheApplication.GetBeforeRequest: TBeforeRequestEvent;
+begin
+  result := TApacheHandler(WebHandler).BeforeRequest;
+end;
+
+function TCustomApacheApplication.GetHandlerName: String;
+begin
+  result := TApacheHandler(WebHandler).HandlerName;
+end;
+
+function TCustomApacheApplication.GetIdleModuleCount: Integer;
+begin
+  result := TApacheHandler(WebHandler).IdleWebModuleCount;
+end;
+
+function TCustomApacheApplication.GetMaxRequests: Integer;
+begin
+  result := TApacheHandler(WebHandler).MaxRequests;
+end;
+
+function TCustomApacheApplication.GetModuleName: String;
+begin
+  result := TApacheHandler(WebHandler).ModuleName;
+end;
+
+function TCustomApacheApplication.GetPriority: THandlerPriority;
+begin
+  result := TApacheHandler(WebHandler).HandlerPriority;
+end;
+
+function TCustomApacheApplication.GetWorkingModuleCount: Integer;
+begin
+  result := TApacheHandler(WebHandler).WorkingWebModuleCount;
+end;
+
+procedure TCustomApacheApplication.SetAfterModules(const AValue: TStrings);
+begin
+  TApacheHandler(WebHandler).AfterModules := AValue;
+end;
+
+procedure TCustomApacheApplication.SetBaseLocation(const AValue: String);
+begin
+  TApacheHandler(WebHandler).BaseLocation := AValue;
+end;
+
+procedure TCustomApacheApplication.SetBeforeModules(const AValue: TStrings);
+begin
+  TApacheHandler(WebHandler).BeforeModules := AValue;
+end;
+
+procedure TCustomApacheApplication.SetBeforeRequest(const AValue: TBeforeRequestEvent);
+begin
+  TApacheHandler(WebHandler).BeforeRequest := AValue;
+end;
+
+procedure TCustomApacheApplication.SetHandlerName(const AValue: String);
+begin
+  TApacheHandler(WebHandler).HandlerName := AValue;
+end;
+
+procedure TCustomApacheApplication.SetMaxRequests(const AValue: Integer);
+begin
+  TApacheHandler(WebHandler).MaxRequests := AValue;
+end;
+
+procedure TCustomApacheApplication.SetModuleName(const AValue: String);
+begin
+  TApacheHandler(WebHandler).ModuleName := AValue;
+end;
+
+procedure TCustomApacheApplication.SetPriority(const AValue: THandlerPriority);
+begin
+  TApacheHandler(WebHandler).HandlerPriority := AValue;
+end;
+
+function TCustomApacheApplication.InitializeWebHandler: TWebHandler;
+begin
+  Result:=TApacheHandler.Create(self);
+end;
+
+procedure TCustomApacheApplication.Initialize;
+begin
+  Inherited;
+  TApacheHandler(WebHandler).Initialize;
+end;
+
+procedure TCustomApacheApplication.ShowException(E: Exception);
+begin
+  ap_log_error(PChar(TApacheHandler(WebHandler).ModuleName),  //The file in which this function is called
+               0,                                             //The line number on which this function is called
+               0,                                             //The module_index of the module generating this message
+               APLOG_ERR,                                     //The level of this error message
+               0,                                             //The status code from the previous command
+               Nil,                                           //The server on which we are logging
+               'module: %s',                                  //The format string
+               [Pchar(E.Message)]);                           //The arguments to use to fill out fmt.
+end;
+
+function TCustomApacheApplication.ProcessRequest(P: PRequest_Rec): Integer;
+begin
+  result := TApacheHandler(WebHandler).ProcessRequest(p);
+end;
+
+function TCustomApacheApplication.AllowRequest(P: PRequest_Rec): Boolean;
+begin
+  result := TApacheHandler(WebHandler).AllowRequest(p);
+end;
+
+procedure TCustomApacheApplication.SetModuleRecord(var ModuleRecord: Module);
+begin
+  TApacheHandler(WebHandler).SetModuleRecord(ModuleRecord);
+end;
+
+Initialization
+  BeginThread(@__dummythread);//crash prevention for simultaneous requests
+  InitApache;
+  
+Finalization
+  DoneApache;
+  
+end.

+ 2804 - 0
packages/httpd24/Makefile

@@ -0,0 +1,2804 @@
+#
+# Don't edit, this file is generated by FPCMake Version 2.0.0 [2013/01/27]
+#
+default: all
+MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian i386-nativent i386-iphonesim m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos m68k-embedded powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos powerpc-darwin powerpc-morphos powerpc-embedded powerpc-wii sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-netbsd x86_64-solaris x86_64-openbsd x86_64-darwin x86_64-win64 x86_64-embedded arm-linux arm-palmos arm-darwin arm-wince arm-gba arm-nds arm-embedded arm-symbian powerpc64-linux powerpc64-darwin powerpc64-embedded avr-embedded armeb-linux armeb-embedded mipsel-linux
+BSDs = freebsd netbsd openbsd darwin
+UNIXs = linux $(BSDs) solaris qnx haiku
+LIMIT83fs = go32v2 os2 emx watcom
+OSNeedsComspecToRunBatch = go32v2 watcom
+FORCE:
+.PHONY: FORCE
+override PATH:=$(patsubst %/,%,$(subst \,/,$(PATH)))
+ifneq ($(findstring darwin,$(OSTYPE)),)
+inUnix=1 #darwin
+SEARCHPATH:=$(filter-out .,$(subst :, ,$(PATH)))
+else
+ifeq ($(findstring ;,$(PATH)),)
+inUnix=1
+SEARCHPATH:=$(filter-out .,$(subst :, ,$(PATH)))
+else
+SEARCHPATH:=$(subst ;, ,$(PATH))
+endif
+endif
+SEARCHPATH+=$(patsubst %/,%,$(subst \,/,$(dir $(MAKE))))
+PWD:=$(strip $(wildcard $(addsuffix /pwd.exe,$(SEARCHPATH))))
+ifeq ($(PWD),)
+PWD:=$(strip $(wildcard $(addsuffix /pwd,$(SEARCHPATH))))
+ifeq ($(PWD),)
+$(error You need the GNU utils package to use this Makefile)
+else
+PWD:=$(firstword $(PWD))
+SRCEXEEXT=
+endif
+else
+PWD:=$(firstword $(PWD))
+SRCEXEEXT=.exe
+endif
+ifndef inUnix
+ifeq ($(OS),Windows_NT)
+inWinNT=1
+else
+ifdef OS2_SHELL
+inOS2=1
+endif
+endif
+else
+ifneq ($(findstring cygdrive,$(PATH)),)
+inCygWin=1
+endif
+endif
+ifdef inUnix
+SRCBATCHEXT=.sh
+else
+ifdef inOS2
+SRCBATCHEXT=.cmd
+else
+SRCBATCHEXT=.bat
+endif
+endif
+ifdef COMSPEC
+ifneq ($(findstring $(OS_SOURCE),$(OSNeedsComspecToRunBatch)),)
+ifndef RUNBATCH
+RUNBATCH=$(COMSPEC) /C
+endif
+endif
+endif
+ifdef inUnix
+PATHSEP=/
+else
+PATHSEP:=$(subst /,\,/)
+ifdef inCygWin
+PATHSEP=/
+endif
+endif
+ifdef PWD
+BASEDIR:=$(subst \,/,$(shell $(PWD)))
+ifdef inCygWin
+ifneq ($(findstring /cygdrive/,$(BASEDIR)),)
+BASENODIR:=$(patsubst /cygdrive%,%,$(BASEDIR))
+BASEDRIVE:=$(firstword $(subst /, ,$(BASENODIR)))
+BASEDIR:=$(subst /cygdrive/$(BASEDRIVE)/,$(BASEDRIVE):/,$(BASEDIR))
+endif
+endif
+else
+BASEDIR=.
+endif
+ifdef inOS2
+ifndef ECHO
+ECHO:=$(strip $(wildcard $(addsuffix /gecho$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(ECHO),)
+ECHO:=$(strip $(wildcard $(addsuffix /echo$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(ECHO),)
+ECHO=echo
+else
+ECHO:=$(firstword $(ECHO))
+endif
+else
+ECHO:=$(firstword $(ECHO))
+endif
+endif
+export ECHO
+endif
+override DEFAULT_FPCDIR=../..
+ifndef FPC
+ifdef PP
+FPC=$(PP)
+endif
+endif
+ifndef FPC
+FPCPROG:=$(strip $(wildcard $(addsuffix /fpc$(SRCEXEEXT),$(SEARCHPATH))))
+ifneq ($(FPCPROG),)
+FPCPROG:=$(firstword $(FPCPROG))
+ifneq ($(CPU_TARGET),)
+FPC:=$(shell $(FPCPROG) -P$(CPU_TARGET) -PB)
+else
+FPC:=$(shell $(FPCPROG) -PB)
+endif
+ifneq ($(findstring Error,$(FPC)),)
+override FPC=$(firstword $(strip $(wildcard $(addsuffix /ppc386$(SRCEXEEXT),$(SEARCHPATH)))))
+else
+ifeq ($(strip $(wildcard $(FPC))),)
+FPC:=$(firstword $(FPCPROG))
+endif
+endif
+else
+override FPC=$(firstword $(strip $(wildcard $(addsuffix /ppc386$(SRCEXEEXT),$(SEARCHPATH)))))
+endif
+endif
+override FPC:=$(subst $(SRCEXEEXT),,$(FPC))
+override FPC:=$(subst \,/,$(FPC))$(SRCEXEEXT)
+FOUNDFPC:=$(strip $(wildcard $(FPC)))
+ifeq ($(FOUNDFPC),)
+FOUNDFPC=$(strip $(wildcard $(addsuffix /$(FPC),$(SEARCHPATH))))
+ifeq ($(FOUNDFPC),)
+$(error Compiler $(FPC) not found)
+endif
+endif
+ifndef FPC_COMPILERINFO
+FPC_COMPILERINFO:=$(shell $(FPC) -iVSPTPSOTO)
+endif
+ifndef FPC_VERSION
+FPC_VERSION:=$(word 1,$(FPC_COMPILERINFO))
+endif
+export FPC FPC_VERSION FPC_COMPILERINFO
+unexport CHECKDEPEND ALLDEPENDENCIES
+ifndef CPU_TARGET
+ifdef CPU_TARGET_DEFAULT
+CPU_TARGET=$(CPU_TARGET_DEFAULT)
+endif
+endif
+ifndef OS_TARGET
+ifdef OS_TARGET_DEFAULT
+OS_TARGET=$(OS_TARGET_DEFAULT)
+endif
+endif
+ifndef CPU_SOURCE
+CPU_SOURCE:=$(word 2,$(FPC_COMPILERINFO))
+endif
+ifndef CPU_TARGET
+CPU_TARGET:=$(word 3,$(FPC_COMPILERINFO))
+endif
+ifndef OS_SOURCE
+OS_SOURCE:=$(word 4,$(FPC_COMPILERINFO))
+endif
+ifndef OS_TARGET
+OS_TARGET:=$(word 5,$(FPC_COMPILERINFO))
+endif
+FULL_TARGET=$(CPU_TARGET)-$(OS_TARGET)
+FULL_SOURCE=$(CPU_SOURCE)-$(OS_SOURCE)
+ifeq ($(CPU_TARGET),armeb)
+ARCH=arm
+override FPCOPT+=-Cb
+else
+ifeq ($(CPU_TARGET),armel)
+ARCH=arm
+override FPCOPT+=-CaEABI
+else
+ARCH=$(CPU_TARGET)
+endif
+endif
+ifneq ($(findstring $(OS_SOURCE),$(LIMIT83fs)),)
+TARGETSUFFIX=$(OS_TARGET)
+SOURCESUFFIX=$(OS_SOURCE)
+else
+ifneq ($(findstring $(OS_TARGET),$(LIMIT83fs)),)
+TARGETSUFFIX=$(OS_TARGET)
+else
+TARGETSUFFIX=$(FULL_TARGET)
+endif
+SOURCESUFFIX=$(FULL_SOURCE)
+endif
+ifneq ($(FULL_TARGET),$(FULL_SOURCE))
+CROSSCOMPILE=1
+endif
+ifeq ($(findstring makefile,$(MAKECMDGOALS)),)
+ifeq ($(findstring $(FULL_TARGET),$(MAKEFILETARGETS)),)
+$(error The Makefile doesn't support target $(FULL_TARGET), please run fpcmake first)
+endif
+endif
+ifneq ($(findstring $(OS_TARGET),$(BSDs)),)
+BSDhier=1
+endif
+ifeq ($(OS_TARGET),linux)
+linuxHier=1
+endif
+export OS_TARGET OS_SOURCE ARCH CPU_TARGET CPU_SOURCE FULL_TARGET FULL_SOURCE TARGETSUFFIX SOURCESUFFIX CROSSCOMPILE
+ifdef FPCDIR
+override FPCDIR:=$(subst \,/,$(FPCDIR))
+ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),)
+override FPCDIR=wrong
+endif
+else
+override FPCDIR=wrong
+endif
+ifdef DEFAULT_FPCDIR
+ifeq ($(FPCDIR),wrong)
+override FPCDIR:=$(subst \,/,$(DEFAULT_FPCDIR))
+ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),)
+override FPCDIR=wrong
+endif
+endif
+endif
+ifeq ($(FPCDIR),wrong)
+ifdef inUnix
+override FPCDIR=/usr/local/lib/fpc/$(FPC_VERSION)
+ifeq ($(wildcard $(FPCDIR)/units),)
+override FPCDIR=/usr/lib/fpc/$(FPC_VERSION)
+endif
+else
+override FPCDIR:=$(subst /$(FPC),,$(firstword $(strip $(wildcard $(addsuffix /$(FPC),$(SEARCHPATH))))))
+override FPCDIR:=$(FPCDIR)/..
+ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),)
+override FPCDIR:=$(FPCDIR)/..
+ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),)
+override FPCDIR:=$(BASEDIR)
+ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),)
+override FPCDIR=c:/pp
+endif
+endif
+endif
+endif
+endif
+ifndef CROSSBINDIR
+CROSSBINDIR:=$(wildcard $(FPCDIR)/bin/$(TARGETSUFFIX))
+endif
+ifneq ($(findstring $(OS_TARGET),darwin iphonesim),)
+ifeq ($(OS_SOURCE),darwin)
+DARWIN2DARWIN=1
+endif
+endif
+ifndef BINUTILSPREFIX
+ifndef CROSSBINDIR
+ifdef CROSSCOMPILE
+ifndef DARWIN2DARWIN
+BINUTILSPREFIX=$(CPU_TARGET)-$(OS_TARGET)-
+endif
+endif
+endif
+endif
+UNITSDIR:=$(wildcard $(FPCDIR)/units/$(TARGETSUFFIX))
+ifeq ($(UNITSDIR),)
+UNITSDIR:=$(wildcard $(FPCDIR)/units/$(OS_TARGET))
+endif
+PACKAGESDIR:=$(wildcard $(FPCDIR) $(FPCDIR)/packages $(FPCDIR)/packages/base $(FPCDIR)/packages/extra)
+ifndef FPCFPMAKE
+ifdef CROSSCOMPILE
+ifeq ($(strip $(wildcard $(addsuffix /compiler/ppc$(SRCEXEEXT),$(FPCDIR)))),)
+FPCPROG:=$(strip $(wildcard $(addsuffix /fpc$(SRCEXEEXT),$(SEARCHPATH))))
+ifneq ($(FPCPROG),)
+FPCPROG:=$(firstword $(FPCPROG))
+FPCFPMAKE:=$(shell $(FPCPROG) -PB)
+ifeq ($(strip $(wildcard $(FPCFPMAKE))),)
+FPCFPMAKE:=$(firstword $(FPCPROG))
+endif
+else
+override FPCFPMAKE=$(firstword $(strip $(wildcard $(addsuffix /ppc386$(SRCEXEEXT),$(SEARCHPATH)))))
+endif
+else
+FPCFPMAKE=$(strip $(wildcard $(addsuffix /compiler/ppc$(SRCEXEEXT),$(FPCDIR))))
+FPMAKE_SKIP_CONFIG=-n
+export FPCFPMAKE
+export FPMAKE_SKIP_CONFIG
+endif
+else
+FPMAKE_SKIP_CONFIG=-n
+FPCFPMAKE=$(FPC)
+endif
+endif
+override PACKAGE_NAME=httpd24
+override PACKAGE_VERSION=2.6.3
+ifeq ($(FULL_TARGET),i386-linux)
+override TARGET_UNITS+=apr24 httpd24
+endif
+ifeq ($(FULL_TARGET),i386-go32v2)
+override TARGET_UNITS+=apr24 httpd24
+endif
+ifeq ($(FULL_TARGET),i386-win32)
+override TARGET_UNITS+=apr24 httpd24
+endif
+ifeq ($(FULL_TARGET),i386-os2)
+override TARGET_UNITS+=apr24 httpd24
+endif
+ifeq ($(FULL_TARGET),i386-freebsd)
+override TARGET_UNITS+=apr24 httpd24
+endif
+ifeq ($(FULL_TARGET),i386-beos)
+override TARGET_UNITS+=apr24 httpd24
+endif
+ifeq ($(FULL_TARGET),i386-haiku)
+override TARGET_UNITS+=apr24 httpd24
+endif
+ifeq ($(FULL_TARGET),i386-netbsd)
+override TARGET_UNITS+=apr24 httpd24
+endif
+ifeq ($(FULL_TARGET),i386-solaris)
+override TARGET_UNITS+=apr24 httpd24
+endif
+ifeq ($(FULL_TARGET),i386-qnx)
+override TARGET_UNITS+=apr24 httpd24
+endif
+ifeq ($(FULL_TARGET),i386-netware)
+override TARGET_UNITS+=apr24 httpd24
+endif
+ifeq ($(FULL_TARGET),i386-openbsd)
+override TARGET_UNITS+=apr24 httpd24
+endif
+ifeq ($(FULL_TARGET),i386-wdosx)
+override TARGET_UNITS+=apr24 httpd24
+endif
+ifeq ($(FULL_TARGET),i386-darwin)
+override TARGET_UNITS+=apr24 httpd24
+endif
+ifeq ($(FULL_TARGET),i386-emx)
+override TARGET_UNITS+=apr24 httpd24
+endif
+ifeq ($(FULL_TARGET),i386-watcom)
+override TARGET_UNITS+=apr24 httpd24
+endif
+ifeq ($(FULL_TARGET),i386-netwlibc)
+override TARGET_UNITS+=apr24 httpd24
+endif
+ifeq ($(FULL_TARGET),i386-wince)
+override TARGET_UNITS+=apr24 httpd24
+endif
+ifeq ($(FULL_TARGET),i386-embedded)
+override TARGET_UNITS+=apr24 httpd24
+endif
+ifeq ($(FULL_TARGET),i386-symbian)
+override TARGET_UNITS+=apr24 httpd24
+endif
+ifeq ($(FULL_TARGET),i386-nativent)
+override TARGET_UNITS+=apr24 httpd24
+endif
+ifeq ($(FULL_TARGET),i386-iphonesim)
+override TARGET_UNITS+=apr24 httpd24
+endif
+ifeq ($(FULL_TARGET),m68k-linux)
+override TARGET_UNITS+=apr24 httpd24
+endif
+ifeq ($(FULL_TARGET),m68k-freebsd)
+override TARGET_UNITS+=apr24 httpd24
+endif
+ifeq ($(FULL_TARGET),m68k-netbsd)
+override TARGET_UNITS+=apr24 httpd24
+endif
+ifeq ($(FULL_TARGET),m68k-amiga)
+override TARGET_UNITS+=apr24 httpd24
+endif
+ifeq ($(FULL_TARGET),m68k-atari)
+override TARGET_UNITS+=apr24 httpd24
+endif
+ifeq ($(FULL_TARGET),m68k-openbsd)
+override TARGET_UNITS+=apr24 httpd24
+endif
+ifeq ($(FULL_TARGET),m68k-palmos)
+override TARGET_UNITS+=apr24 httpd24
+endif
+ifeq ($(FULL_TARGET),m68k-embedded)
+override TARGET_UNITS+=apr24 httpd24
+endif
+ifeq ($(FULL_TARGET),powerpc-linux)
+override TARGET_UNITS+=apr24 httpd24
+endif
+ifeq ($(FULL_TARGET),powerpc-netbsd)
+override TARGET_UNITS+=apr24 httpd24
+endif
+ifeq ($(FULL_TARGET),powerpc-amiga)
+override TARGET_UNITS+=apr24 httpd24
+endif
+ifeq ($(FULL_TARGET),powerpc-macos)
+override TARGET_UNITS+=apr24 httpd24
+endif
+ifeq ($(FULL_TARGET),powerpc-darwin)
+override TARGET_UNITS+=apr24 httpd24
+endif
+ifeq ($(FULL_TARGET),powerpc-morphos)
+override TARGET_UNITS+=apr24 httpd24
+endif
+ifeq ($(FULL_TARGET),powerpc-embedded)
+override TARGET_UNITS+=apr24 httpd24
+endif
+ifeq ($(FULL_TARGET),powerpc-wii)
+override TARGET_UNITS+=apr24 httpd24
+endif
+ifeq ($(FULL_TARGET),sparc-linux)
+override TARGET_UNITS+=apr24 httpd24
+endif
+ifeq ($(FULL_TARGET),sparc-netbsd)
+override TARGET_UNITS+=apr24 httpd24
+endif
+ifeq ($(FULL_TARGET),sparc-solaris)
+override TARGET_UNITS+=apr24 httpd24
+endif
+ifeq ($(FULL_TARGET),sparc-embedded)
+override TARGET_UNITS+=apr24 httpd24
+endif
+ifeq ($(FULL_TARGET),x86_64-linux)
+override TARGET_UNITS+=apr24 httpd24
+endif
+ifeq ($(FULL_TARGET),x86_64-freebsd)
+override TARGET_UNITS+=apr24 httpd24
+endif
+ifeq ($(FULL_TARGET),x86_64-netbsd)
+override TARGET_UNITS+=apr24 httpd24
+endif
+ifeq ($(FULL_TARGET),x86_64-solaris)
+override TARGET_UNITS+=apr24 httpd24
+endif
+ifeq ($(FULL_TARGET),x86_64-openbsd)
+override TARGET_UNITS+=apr24 httpd24
+endif
+ifeq ($(FULL_TARGET),x86_64-darwin)
+override TARGET_UNITS+=apr24 httpd24
+endif
+ifeq ($(FULL_TARGET),x86_64-win64)
+override TARGET_UNITS+=apr24 httpd24
+endif
+ifeq ($(FULL_TARGET),x86_64-embedded)
+override TARGET_UNITS+=apr24 httpd24
+endif
+ifeq ($(FULL_TARGET),arm-linux)
+override TARGET_UNITS+=apr24 httpd24
+endif
+ifeq ($(FULL_TARGET),arm-palmos)
+override TARGET_UNITS+=apr24 httpd24
+endif
+ifeq ($(FULL_TARGET),arm-darwin)
+override TARGET_UNITS+=apr24 httpd24
+endif
+ifeq ($(FULL_TARGET),arm-wince)
+override TARGET_UNITS+=apr24 httpd24
+endif
+ifeq ($(FULL_TARGET),arm-gba)
+override TARGET_UNITS+=apr24 httpd24
+endif
+ifeq ($(FULL_TARGET),arm-nds)
+override TARGET_UNITS+=apr24 httpd24
+endif
+ifeq ($(FULL_TARGET),arm-embedded)
+override TARGET_UNITS+=apr24 httpd24
+endif
+ifeq ($(FULL_TARGET),arm-symbian)
+override TARGET_UNITS+=apr24 httpd24
+endif
+ifeq ($(FULL_TARGET),powerpc64-linux)
+override TARGET_UNITS+=apr24 httpd24
+endif
+ifeq ($(FULL_TARGET),powerpc64-darwin)
+override TARGET_UNITS+=apr24 httpd24
+endif
+ifeq ($(FULL_TARGET),powerpc64-embedded)
+override TARGET_UNITS+=apr24 httpd24
+endif
+ifeq ($(FULL_TARGET),avr-embedded)
+override TARGET_UNITS+=apr24 httpd24
+endif
+ifeq ($(FULL_TARGET),armeb-linux)
+override TARGET_UNITS+=apr24 httpd24
+endif
+ifeq ($(FULL_TARGET),armeb-embedded)
+override TARGET_UNITS+=apr24 httpd24
+endif
+ifeq ($(FULL_TARGET),mipsel-linux)
+override TARGET_UNITS+=apr24 httpd24
+endif
+ifeq ($(FULL_TARGET),i386-linux)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),i386-go32v2)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),i386-win32)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),i386-os2)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),i386-freebsd)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),i386-beos)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),i386-haiku)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),i386-netbsd)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),i386-solaris)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),i386-qnx)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),i386-netware)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),i386-openbsd)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),i386-wdosx)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),i386-darwin)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),i386-emx)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),i386-watcom)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),i386-netwlibc)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),i386-wince)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),i386-embedded)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),i386-symbian)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),i386-nativent)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),i386-iphonesim)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),m68k-linux)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),m68k-freebsd)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),m68k-netbsd)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),m68k-amiga)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),m68k-atari)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),m68k-openbsd)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),m68k-palmos)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),m68k-embedded)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),powerpc-linux)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),powerpc-netbsd)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),powerpc-amiga)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),powerpc-macos)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),powerpc-darwin)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),powerpc-morphos)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),powerpc-embedded)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),powerpc-wii)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),sparc-linux)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),sparc-netbsd)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),sparc-solaris)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),sparc-embedded)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),x86_64-linux)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),x86_64-freebsd)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),x86_64-netbsd)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),x86_64-solaris)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),x86_64-openbsd)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),x86_64-darwin)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),x86_64-win64)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),x86_64-embedded)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),arm-linux)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),arm-palmos)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),arm-darwin)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),arm-wince)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),arm-gba)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),arm-nds)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),arm-embedded)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),arm-symbian)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),powerpc64-linux)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),powerpc64-darwin)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),powerpc64-embedded)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),avr-embedded)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),armeb-linux)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),armeb-embedded)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),mipsel-linux)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+override INSTALL_FPCPACKAGE=y
+ifeq ($(FULL_TARGET),i386-linux)
+override COMPILER_INCLUDEDIR+=src src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),i386-go32v2)
+override COMPILER_INCLUDEDIR+=src src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),i386-win32)
+override COMPILER_INCLUDEDIR+=src src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),i386-os2)
+override COMPILER_INCLUDEDIR+=src src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),i386-freebsd)
+override COMPILER_INCLUDEDIR+=src src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),i386-beos)
+override COMPILER_INCLUDEDIR+=src src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),i386-haiku)
+override COMPILER_INCLUDEDIR+=src src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),i386-netbsd)
+override COMPILER_INCLUDEDIR+=src src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),i386-solaris)
+override COMPILER_INCLUDEDIR+=src src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),i386-qnx)
+override COMPILER_INCLUDEDIR+=src src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),i386-netware)
+override COMPILER_INCLUDEDIR+=src src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),i386-openbsd)
+override COMPILER_INCLUDEDIR+=src src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),i386-wdosx)
+override COMPILER_INCLUDEDIR+=src src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),i386-darwin)
+override COMPILER_INCLUDEDIR+=src src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),i386-emx)
+override COMPILER_INCLUDEDIR+=src src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),i386-watcom)
+override COMPILER_INCLUDEDIR+=src src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),i386-netwlibc)
+override COMPILER_INCLUDEDIR+=src src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),i386-wince)
+override COMPILER_INCLUDEDIR+=src src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),i386-embedded)
+override COMPILER_INCLUDEDIR+=src src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),i386-symbian)
+override COMPILER_INCLUDEDIR+=src src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),i386-nativent)
+override COMPILER_INCLUDEDIR+=src src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),i386-iphonesim)
+override COMPILER_INCLUDEDIR+=src src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),m68k-linux)
+override COMPILER_INCLUDEDIR+=src src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),m68k-freebsd)
+override COMPILER_INCLUDEDIR+=src src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),m68k-netbsd)
+override COMPILER_INCLUDEDIR+=src src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),m68k-amiga)
+override COMPILER_INCLUDEDIR+=src src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),m68k-atari)
+override COMPILER_INCLUDEDIR+=src src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),m68k-openbsd)
+override COMPILER_INCLUDEDIR+=src src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),m68k-palmos)
+override COMPILER_INCLUDEDIR+=src src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),m68k-embedded)
+override COMPILER_INCLUDEDIR+=src src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),powerpc-linux)
+override COMPILER_INCLUDEDIR+=src src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),powerpc-netbsd)
+override COMPILER_INCLUDEDIR+=src src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),powerpc-amiga)
+override COMPILER_INCLUDEDIR+=src src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),powerpc-macos)
+override COMPILER_INCLUDEDIR+=src src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),powerpc-darwin)
+override COMPILER_INCLUDEDIR+=src src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),powerpc-morphos)
+override COMPILER_INCLUDEDIR+=src src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),powerpc-embedded)
+override COMPILER_INCLUDEDIR+=src src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),powerpc-wii)
+override COMPILER_INCLUDEDIR+=src src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),sparc-linux)
+override COMPILER_INCLUDEDIR+=src src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),sparc-netbsd)
+override COMPILER_INCLUDEDIR+=src src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),sparc-solaris)
+override COMPILER_INCLUDEDIR+=src src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),sparc-embedded)
+override COMPILER_INCLUDEDIR+=src src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),x86_64-linux)
+override COMPILER_INCLUDEDIR+=src src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),x86_64-freebsd)
+override COMPILER_INCLUDEDIR+=src src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),x86_64-netbsd)
+override COMPILER_INCLUDEDIR+=src src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),x86_64-solaris)
+override COMPILER_INCLUDEDIR+=src src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),x86_64-openbsd)
+override COMPILER_INCLUDEDIR+=src src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),x86_64-darwin)
+override COMPILER_INCLUDEDIR+=src src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),x86_64-win64)
+override COMPILER_INCLUDEDIR+=src src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),x86_64-embedded)
+override COMPILER_INCLUDEDIR+=src src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),arm-linux)
+override COMPILER_INCLUDEDIR+=src src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),arm-palmos)
+override COMPILER_INCLUDEDIR+=src src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),arm-darwin)
+override COMPILER_INCLUDEDIR+=src src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),arm-wince)
+override COMPILER_INCLUDEDIR+=src src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),arm-gba)
+override COMPILER_INCLUDEDIR+=src src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),arm-nds)
+override COMPILER_INCLUDEDIR+=src src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),arm-embedded)
+override COMPILER_INCLUDEDIR+=src src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),arm-symbian)
+override COMPILER_INCLUDEDIR+=src src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),powerpc64-linux)
+override COMPILER_INCLUDEDIR+=src src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),powerpc64-darwin)
+override COMPILER_INCLUDEDIR+=src src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),powerpc64-embedded)
+override COMPILER_INCLUDEDIR+=src src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),avr-embedded)
+override COMPILER_INCLUDEDIR+=src src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),armeb-linux)
+override COMPILER_INCLUDEDIR+=src src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),armeb-embedded)
+override COMPILER_INCLUDEDIR+=src src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),mipsel-linux)
+override COMPILER_INCLUDEDIR+=src src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),i386-linux)
+override COMPILER_SOURCEDIR+=src tests src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),i386-go32v2)
+override COMPILER_SOURCEDIR+=src tests src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),i386-win32)
+override COMPILER_SOURCEDIR+=src tests src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),i386-os2)
+override COMPILER_SOURCEDIR+=src tests src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),i386-freebsd)
+override COMPILER_SOURCEDIR+=src tests src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),i386-beos)
+override COMPILER_SOURCEDIR+=src tests src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),i386-haiku)
+override COMPILER_SOURCEDIR+=src tests src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),i386-netbsd)
+override COMPILER_SOURCEDIR+=src tests src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),i386-solaris)
+override COMPILER_SOURCEDIR+=src tests src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),i386-qnx)
+override COMPILER_SOURCEDIR+=src tests src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),i386-netware)
+override COMPILER_SOURCEDIR+=src tests src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),i386-openbsd)
+override COMPILER_SOURCEDIR+=src tests src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),i386-wdosx)
+override COMPILER_SOURCEDIR+=src tests src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),i386-darwin)
+override COMPILER_SOURCEDIR+=src tests src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),i386-emx)
+override COMPILER_SOURCEDIR+=src tests src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),i386-watcom)
+override COMPILER_SOURCEDIR+=src tests src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),i386-netwlibc)
+override COMPILER_SOURCEDIR+=src tests src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),i386-wince)
+override COMPILER_SOURCEDIR+=src tests src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),i386-embedded)
+override COMPILER_SOURCEDIR+=src tests src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),i386-symbian)
+override COMPILER_SOURCEDIR+=src tests src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),i386-nativent)
+override COMPILER_SOURCEDIR+=src tests src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),i386-iphonesim)
+override COMPILER_SOURCEDIR+=src tests src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),m68k-linux)
+override COMPILER_SOURCEDIR+=src tests src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),m68k-freebsd)
+override COMPILER_SOURCEDIR+=src tests src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),m68k-netbsd)
+override COMPILER_SOURCEDIR+=src tests src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),m68k-amiga)
+override COMPILER_SOURCEDIR+=src tests src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),m68k-atari)
+override COMPILER_SOURCEDIR+=src tests src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),m68k-openbsd)
+override COMPILER_SOURCEDIR+=src tests src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),m68k-palmos)
+override COMPILER_SOURCEDIR+=src tests src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),m68k-embedded)
+override COMPILER_SOURCEDIR+=src tests src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),powerpc-linux)
+override COMPILER_SOURCEDIR+=src tests src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),powerpc-netbsd)
+override COMPILER_SOURCEDIR+=src tests src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),powerpc-amiga)
+override COMPILER_SOURCEDIR+=src tests src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),powerpc-macos)
+override COMPILER_SOURCEDIR+=src tests src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),powerpc-darwin)
+override COMPILER_SOURCEDIR+=src tests src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),powerpc-morphos)
+override COMPILER_SOURCEDIR+=src tests src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),powerpc-embedded)
+override COMPILER_SOURCEDIR+=src tests src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),powerpc-wii)
+override COMPILER_SOURCEDIR+=src tests src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),sparc-linux)
+override COMPILER_SOURCEDIR+=src tests src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),sparc-netbsd)
+override COMPILER_SOURCEDIR+=src tests src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),sparc-solaris)
+override COMPILER_SOURCEDIR+=src tests src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),sparc-embedded)
+override COMPILER_SOURCEDIR+=src tests src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),x86_64-linux)
+override COMPILER_SOURCEDIR+=src tests src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),x86_64-freebsd)
+override COMPILER_SOURCEDIR+=src tests src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),x86_64-netbsd)
+override COMPILER_SOURCEDIR+=src tests src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),x86_64-solaris)
+override COMPILER_SOURCEDIR+=src tests src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),x86_64-openbsd)
+override COMPILER_SOURCEDIR+=src tests src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),x86_64-darwin)
+override COMPILER_SOURCEDIR+=src tests src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),x86_64-win64)
+override COMPILER_SOURCEDIR+=src tests src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),x86_64-embedded)
+override COMPILER_SOURCEDIR+=src tests src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),arm-linux)
+override COMPILER_SOURCEDIR+=src tests src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),arm-palmos)
+override COMPILER_SOURCEDIR+=src tests src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),arm-darwin)
+override COMPILER_SOURCEDIR+=src tests src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),arm-wince)
+override COMPILER_SOURCEDIR+=src tests src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),arm-gba)
+override COMPILER_SOURCEDIR+=src tests src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),arm-nds)
+override COMPILER_SOURCEDIR+=src tests src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),arm-embedded)
+override COMPILER_SOURCEDIR+=src tests src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),arm-symbian)
+override COMPILER_SOURCEDIR+=src tests src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),powerpc64-linux)
+override COMPILER_SOURCEDIR+=src tests src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),powerpc64-darwin)
+override COMPILER_SOURCEDIR+=src tests src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),powerpc64-embedded)
+override COMPILER_SOURCEDIR+=src tests src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),avr-embedded)
+override COMPILER_SOURCEDIR+=src tests src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),armeb-linux)
+override COMPILER_SOURCEDIR+=src tests src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),armeb-embedded)
+override COMPILER_SOURCEDIR+=src tests src/apr src/aprutil
+endif
+ifeq ($(FULL_TARGET),mipsel-linux)
+override COMPILER_SOURCEDIR+=src tests src/apr src/aprutil
+endif
+ifdef REQUIRE_UNITSDIR
+override UNITSDIR+=$(REQUIRE_UNITSDIR)
+endif
+ifdef REQUIRE_PACKAGESDIR
+override PACKAGESDIR+=$(REQUIRE_PACKAGESDIR)
+endif
+ifdef ZIPINSTALL
+ifneq ($(findstring $(OS_TARGET),$(UNIXs)),)
+UNIXHier=1
+endif
+else
+ifneq ($(findstring $(OS_SOURCE),$(UNIXs)),)
+UNIXHier=1
+endif
+endif
+ifndef INSTALL_PREFIX
+ifdef PREFIX
+INSTALL_PREFIX=$(PREFIX)
+endif
+endif
+ifndef INSTALL_PREFIX
+ifdef UNIXHier
+INSTALL_PREFIX=/usr/local
+else
+ifdef INSTALL_FPCPACKAGE
+INSTALL_BASEDIR:=/pp
+else
+INSTALL_BASEDIR:=/$(PACKAGE_NAME)
+endif
+endif
+endif
+export INSTALL_PREFIX
+ifdef INSTALL_FPCSUBDIR
+export INSTALL_FPCSUBDIR
+endif
+ifndef DIST_DESTDIR
+DIST_DESTDIR:=$(BASEDIR)
+endif
+export DIST_DESTDIR
+ifndef COMPILER_UNITTARGETDIR
+ifdef PACKAGEDIR_MAIN
+COMPILER_UNITTARGETDIR=$(PACKAGEDIR_MAIN)/units/$(TARGETSUFFIX)
+else
+COMPILER_UNITTARGETDIR=units/$(TARGETSUFFIX)
+endif
+endif
+ifndef COMPILER_TARGETDIR
+COMPILER_TARGETDIR=.
+endif
+ifndef INSTALL_BASEDIR
+ifdef UNIXHier
+ifdef INSTALL_FPCPACKAGE
+INSTALL_BASEDIR:=$(INSTALL_PREFIX)/lib/fpc/$(FPC_VERSION)
+else
+INSTALL_BASEDIR:=$(INSTALL_PREFIX)/lib/$(PACKAGE_NAME)
+endif
+else
+INSTALL_BASEDIR:=$(INSTALL_PREFIX)
+endif
+endif
+ifndef INSTALL_BINDIR
+ifdef UNIXHier
+INSTALL_BINDIR:=$(INSTALL_PREFIX)/bin
+else
+INSTALL_BINDIR:=$(INSTALL_BASEDIR)/bin
+ifdef INSTALL_FPCPACKAGE
+ifdef CROSSCOMPILE
+ifdef CROSSINSTALL
+INSTALL_BINDIR:=$(INSTALL_BINDIR)/$(SOURCESUFFIX)
+else
+INSTALL_BINDIR:=$(INSTALL_BINDIR)/$(TARGETSUFFIX)
+endif
+else
+INSTALL_BINDIR:=$(INSTALL_BINDIR)/$(TARGETSUFFIX)
+endif
+endif
+endif
+endif
+ifndef INSTALL_UNITDIR
+INSTALL_UNITDIR:=$(INSTALL_BASEDIR)/units/$(TARGETSUFFIX)
+ifdef INSTALL_FPCPACKAGE
+ifdef PACKAGE_NAME
+INSTALL_UNITDIR:=$(INSTALL_UNITDIR)/$(PACKAGE_NAME)
+endif
+endif
+endif
+ifndef INSTALL_LIBDIR
+ifdef UNIXHier
+INSTALL_LIBDIR:=$(INSTALL_PREFIX)/lib
+else
+INSTALL_LIBDIR:=$(INSTALL_UNITDIR)
+endif
+endif
+ifndef INSTALL_SOURCEDIR
+ifdef UNIXHier
+ifdef BSDhier
+SRCPREFIXDIR=share/src
+else
+ifdef linuxHier
+SRCPREFIXDIR=share/src
+else
+SRCPREFIXDIR=src
+endif
+endif
+ifdef INSTALL_FPCPACKAGE
+ifdef INSTALL_FPCSUBDIR
+INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/$(SRCPREFIXDIR)/fpc-$(FPC_VERSION)/$(INSTALL_FPCSUBDIR)/$(PACKAGE_NAME)
+else
+INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/$(SRCPREFIXDIR)/fpc-$(FPC_VERSION)/$(PACKAGE_NAME)
+endif
+else
+INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/$(SRCPREFIXDIR)/$(PACKAGE_NAME)-$(PACKAGE_VERSION)
+endif
+else
+ifdef INSTALL_FPCPACKAGE
+ifdef INSTALL_FPCSUBDIR
+INSTALL_SOURCEDIR:=$(INSTALL_BASEDIR)/source/$(INSTALL_FPCSUBDIR)/$(PACKAGE_NAME)
+else
+INSTALL_SOURCEDIR:=$(INSTALL_BASEDIR)/source/$(PACKAGE_NAME)
+endif
+else
+INSTALL_SOURCEDIR:=$(INSTALL_BASEDIR)/source
+endif
+endif
+endif
+ifndef INSTALL_DOCDIR
+ifdef UNIXHier
+ifdef BSDhier
+DOCPREFIXDIR=share/doc
+else
+ifdef linuxHier
+DOCPREFIXDIR=share/doc
+else
+DOCPREFIXDIR=doc
+endif
+endif
+ifdef INSTALL_FPCPACKAGE
+INSTALL_DOCDIR:=$(INSTALL_PREFIX)/$(DOCPREFIXDIR)/fpc-$(FPC_VERSION)/$(PACKAGE_NAME)
+else
+INSTALL_DOCDIR:=$(INSTALL_PREFIX)/$(DOCPREFIXDIR)/$(PACKAGE_NAME)-$(PACKAGE_VERSION)
+endif
+else
+ifdef INSTALL_FPCPACKAGE
+INSTALL_DOCDIR:=$(INSTALL_BASEDIR)/doc/$(PACKAGE_NAME)
+else
+INSTALL_DOCDIR:=$(INSTALL_BASEDIR)/doc
+endif
+endif
+endif
+ifndef INSTALL_EXAMPLEDIR
+ifdef UNIXHier
+ifdef INSTALL_FPCPACKAGE
+ifdef BSDhier
+INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/share/examples/fpc-$(FPC_VERSION)/$(PACKAGE_NAME)
+else
+ifdef linuxHier
+INSTALL_EXAMPLEDIR:=$(INSTALL_DOCDIR)/examples
+else
+INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/doc/fpc-$(FPC_VERSION)/examples/$(PACKAGE_NAME)
+endif
+endif
+else
+ifdef BSDhier
+INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/share/examples/$(PACKAGE_NAME)-$(PACKAGE_VERSION)
+else
+ifdef linuxHier
+INSTALL_EXAMPLEDIR:=$(INSTALL_DOCDIR)/examples/$(PACKAGE_NAME)-$(PACKAGE_VERSION)
+else
+INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/doc/$(PACKAGE_NAME)-$(PACKAGE_VERSION)
+endif
+endif
+endif
+else
+ifdef INSTALL_FPCPACKAGE
+INSTALL_EXAMPLEDIR:=$(INSTALL_BASEDIR)/examples/$(PACKAGE_NAME)
+else
+INSTALL_EXAMPLEDIR:=$(INSTALL_BASEDIR)/examples
+endif
+endif
+endif
+ifndef INSTALL_DATADIR
+INSTALL_DATADIR=$(INSTALL_BASEDIR)
+endif
+ifndef INSTALL_SHAREDDIR
+INSTALL_SHAREDDIR=$(INSTALL_PREFIX)/lib
+endif
+ifdef CROSSCOMPILE
+ifndef CROSSBINDIR
+CROSSBINDIR:=$(wildcard $(CROSSTARGETDIR)/bin/$(SOURCESUFFIX))
+ifeq ($(CROSSBINDIR),)
+CROSSBINDIR:=$(wildcard $(INSTALL_BASEDIR)/cross/$(TARGETSUFFIX)/bin/$(FULL_SOURCE))
+endif
+endif
+else
+CROSSBINDIR=
+endif
+ifeq ($(OS_SOURCE),linux)
+ifndef GCCLIBDIR
+ifeq ($(CPU_TARGET),i386)
+ifneq ($(findstring x86_64,$(shell uname -a)),)
+ifeq ($(BINUTILSPREFIX),)
+GCCLIBDIR:=$(shell dirname `gcc -m32 -print-libgcc-file-name`)
+endif
+endif
+endif
+ifeq ($(CPU_TARGET),powerpc64)
+ifeq ($(BINUTILSPREFIX),)
+GCCLIBDIR:=$(shell dirname `gcc -m64 -print-libgcc-file-name`)
+endif
+endif
+endif
+ifndef GCCLIBDIR
+CROSSGCC=$(strip $(wildcard $(addsuffix /$(BINUTILSPREFIX)gcc$(SRCEXEEXT),$(SEARCHPATH))))
+ifneq ($(CROSSGCC),)
+GCCLIBDIR:=$(shell dirname `$(CROSSGCC) -print-libgcc-file-name`)
+endif
+endif
+ifndef OTHERLIBDIR
+OTHERLIBDIR:=$(shell grep -v "^\#" /etc/ld.so.conf | awk '{ ORS=" "; print $1 }')
+endif
+endif
+ifdef inUnix
+ifeq ($(OS_SOURCE),netbsd)
+OTHERLIBDIR+=/usr/pkg/lib
+endif
+export GCCLIBDIR OTHERLIB
+endif
+BATCHEXT=.bat
+LOADEREXT=.as
+EXEEXT=.exe
+PPLEXT=.ppl
+PPUEXT=.ppu
+OEXT=.o
+ASMEXT=.s
+SMARTEXT=.sl
+STATICLIBEXT=.a
+SHAREDLIBEXT=.so
+SHAREDLIBPREFIX=libfp
+STATICLIBPREFIX=libp
+IMPORTLIBPREFIX=libimp
+RSTEXT=.rst
+EXEDBGEXT=.dbg
+ifeq ($(OS_TARGET),go32v1)
+STATICLIBPREFIX=
+SHORTSUFFIX=v1
+endif
+ifeq ($(OS_TARGET),go32v2)
+STATICLIBPREFIX=
+SHORTSUFFIX=dos
+IMPORTLIBPREFIX=
+endif
+ifeq ($(OS_TARGET),watcom)
+STATICLIBPREFIX=
+OEXT=.obj
+ASMEXT=.asm
+SHAREDLIBEXT=.dll
+SHORTSUFFIX=wat
+IMPORTLIBPREFIX=
+endif
+ifeq ($(OS_TARGET),linux)
+BATCHEXT=.sh
+EXEEXT=
+HASSHAREDLIB=1
+SHORTSUFFIX=lnx
+endif
+ifeq ($(OS_TARGET),freebsd)
+BATCHEXT=.sh
+EXEEXT=
+HASSHAREDLIB=1
+SHORTSUFFIX=fbs
+endif
+ifeq ($(OS_TARGET),netbsd)
+BATCHEXT=.sh
+EXEEXT=
+HASSHAREDLIB=1
+SHORTSUFFIX=nbs
+endif
+ifeq ($(OS_TARGET),openbsd)
+BATCHEXT=.sh
+EXEEXT=
+HASSHAREDLIB=1
+SHORTSUFFIX=obs
+endif
+ifeq ($(OS_TARGET),win32)
+SHAREDLIBEXT=.dll
+SHORTSUFFIX=w32
+endif
+ifeq ($(OS_TARGET),os2)
+BATCHEXT=.cmd
+AOUTEXT=.out
+STATICLIBPREFIX=
+SHAREDLIBEXT=.dll
+SHORTSUFFIX=os2
+ECHO=echo
+IMPORTLIBPREFIX=
+endif
+ifeq ($(OS_TARGET),emx)
+BATCHEXT=.cmd
+AOUTEXT=.out
+STATICLIBPREFIX=
+SHAREDLIBEXT=.dll
+SHORTSUFFIX=emx
+ECHO=echo
+IMPORTLIBPREFIX=
+endif
+ifeq ($(OS_TARGET),amiga)
+EXEEXT=
+SHAREDLIBEXT=.library
+SHORTSUFFIX=amg
+endif
+ifeq ($(OS_TARGET),morphos)
+EXEEXT=
+SHAREDLIBEXT=.library
+SHORTSUFFIX=mos
+endif
+ifeq ($(OS_TARGET),atari)
+EXEEXT=.ttp
+SHORTSUFFIX=ata
+endif
+ifeq ($(OS_TARGET),beos)
+BATCHEXT=.sh
+EXEEXT=
+SHORTSUFFIX=be
+endif
+ifeq ($(OS_TARGET),haiku)
+BATCHEXT=.sh
+EXEEXT=
+SHORTSUFFIX=hai
+endif
+ifeq ($(OS_TARGET),solaris)
+BATCHEXT=.sh
+EXEEXT=
+SHORTSUFFIX=sun
+endif
+ifeq ($(OS_TARGET),qnx)
+BATCHEXT=.sh
+EXEEXT=
+SHORTSUFFIX=qnx
+endif
+ifeq ($(OS_TARGET),netware)
+EXEEXT=.nlm
+STATICLIBPREFIX=
+SHORTSUFFIX=nw
+IMPORTLIBPREFIX=imp
+endif
+ifeq ($(OS_TARGET),netwlibc)
+EXEEXT=.nlm
+STATICLIBPREFIX=
+SHORTSUFFIX=nwl
+IMPORTLIBPREFIX=imp
+endif
+ifeq ($(OS_TARGET),macos)
+BATCHEXT=
+EXEEXT=
+DEBUGSYMEXT=.xcoff
+SHORTSUFFIX=mac
+IMPORTLIBPREFIX=imp
+endif
+ifneq ($(findstring $(OS_TARGET),darwin iphonesim),)
+BATCHEXT=.sh
+EXEEXT=
+HASSHAREDLIB=1
+SHORTSUFFIX=dwn
+EXEDBGEXT=.dSYM
+endif
+ifeq ($(OS_TARGET),gba)
+EXEEXT=.gba
+SHAREDLIBEXT=.so
+SHORTSUFFIX=gba
+endif
+ifeq ($(OS_TARGET),symbian)
+SHAREDLIBEXT=.dll
+SHORTSUFFIX=symbian
+endif
+ifeq ($(OS_TARGET),NativeNT)
+SHAREDLIBEXT=.dll
+SHORTSUFFIX=nativent
+endif
+ifeq ($(OS_TARGET),wii)
+EXEEXT=.dol
+SHAREDLIBEXT=.so
+SHORTSUFFIX=wii
+endif
+ifneq ($(findstring $(OS_SOURCE),$(LIMIT83fs)),)
+FPCMADE=fpcmade.$(SHORTSUFFIX)
+ZIPSUFFIX=$(SHORTSUFFIX)
+ZIPCROSSPREFIX=
+ZIPSOURCESUFFIX=src
+ZIPEXAMPLESUFFIX=exm
+else
+FPCMADE=fpcmade.$(TARGETSUFFIX)
+ZIPSOURCESUFFIX=.source
+ZIPEXAMPLESUFFIX=.examples
+ifdef CROSSCOMPILE
+ZIPSUFFIX=.$(SOURCESUFFIX)
+ZIPCROSSPREFIX=$(TARGETSUFFIX)-
+else
+ZIPSUFFIX=.$(TARGETSUFFIX)
+ZIPCROSSPREFIX=
+endif
+endif
+ifndef ECHO
+ECHO:=$(strip $(wildcard $(addsuffix /gecho$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(ECHO),)
+ECHO:=$(strip $(wildcard $(addsuffix /echo$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(ECHO),)
+ECHO= __missing_command_ECHO
+else
+ECHO:=$(firstword $(ECHO))
+endif
+else
+ECHO:=$(firstword $(ECHO))
+endif
+endif
+export ECHO
+ifndef DATE
+DATE:=$(strip $(wildcard $(addsuffix /gdate$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(DATE),)
+DATE:=$(strip $(wildcard $(addsuffix /date$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(DATE),)
+DATE= __missing_command_DATE
+else
+DATE:=$(firstword $(DATE))
+endif
+else
+DATE:=$(firstword $(DATE))
+endif
+endif
+export DATE
+ifndef GINSTALL
+GINSTALL:=$(strip $(wildcard $(addsuffix /ginstall$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(GINSTALL),)
+GINSTALL:=$(strip $(wildcard $(addsuffix /install$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(GINSTALL),)
+GINSTALL= __missing_command_GINSTALL
+else
+GINSTALL:=$(firstword $(GINSTALL))
+endif
+else
+GINSTALL:=$(firstword $(GINSTALL))
+endif
+endif
+export GINSTALL
+ifndef CPPROG
+CPPROG:=$(strip $(wildcard $(addsuffix /cp$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(CPPROG),)
+CPPROG= __missing_command_CPPROG
+else
+CPPROG:=$(firstword $(CPPROG))
+endif
+endif
+export CPPROG
+ifndef RMPROG
+RMPROG:=$(strip $(wildcard $(addsuffix /rm$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(RMPROG),)
+RMPROG= __missing_command_RMPROG
+else
+RMPROG:=$(firstword $(RMPROG))
+endif
+endif
+export RMPROG
+ifndef MVPROG
+MVPROG:=$(strip $(wildcard $(addsuffix /mv$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(MVPROG),)
+MVPROG= __missing_command_MVPROG
+else
+MVPROG:=$(firstword $(MVPROG))
+endif
+endif
+export MVPROG
+ifndef MKDIRPROG
+MKDIRPROG:=$(strip $(wildcard $(addsuffix /gmkdir$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(MKDIRPROG),)
+MKDIRPROG:=$(strip $(wildcard $(addsuffix /mkdir$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(MKDIRPROG),)
+MKDIRPROG= __missing_command_MKDIRPROG
+else
+MKDIRPROG:=$(firstword $(MKDIRPROG))
+endif
+else
+MKDIRPROG:=$(firstword $(MKDIRPROG))
+endif
+endif
+export MKDIRPROG
+ifndef ECHOREDIR
+ifndef inUnix
+ECHOREDIR=echo
+else
+ECHOREDIR=$(ECHO)
+endif
+endif
+ifndef COPY
+COPY:=$(CPPROG) -fp
+endif
+ifndef COPYTREE
+COPYTREE:=$(CPPROG) -Rfp
+endif
+ifndef MKDIRTREE
+MKDIRTREE:=$(MKDIRPROG) -p
+endif
+ifndef MOVE
+MOVE:=$(MVPROG) -f
+endif
+ifndef DEL
+DEL:=$(RMPROG) -f
+endif
+ifndef DELTREE
+DELTREE:=$(RMPROG) -rf
+endif
+ifndef INSTALL
+ifdef inUnix
+INSTALL:=$(GINSTALL) -c -m 644
+else
+INSTALL:=$(COPY)
+endif
+endif
+ifndef INSTALLEXE
+ifdef inUnix
+INSTALLEXE:=$(GINSTALL) -c -m 755
+else
+INSTALLEXE:=$(COPY)
+endif
+endif
+ifndef MKDIR
+MKDIR:=$(GINSTALL) -m 755 -d
+endif
+export ECHOREDIR COPY COPYTREE MOVE DEL DELTREE INSTALL INSTALLEXE MKDIR
+ifndef PPUMOVE
+PPUMOVE:=$(strip $(wildcard $(addsuffix /ppumove$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(PPUMOVE),)
+PPUMOVE= __missing_command_PPUMOVE
+else
+PPUMOVE:=$(firstword $(PPUMOVE))
+endif
+endif
+export PPUMOVE
+ifndef FPCMAKE
+FPCMAKE:=$(strip $(wildcard $(addsuffix /fpcmake$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(FPCMAKE),)
+FPCMAKE= __missing_command_FPCMAKE
+else
+FPCMAKE:=$(firstword $(FPCMAKE))
+endif
+endif
+export FPCMAKE
+ifndef ZIPPROG
+ZIPPROG:=$(strip $(wildcard $(addsuffix /zip$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(ZIPPROG),)
+ZIPPROG= __missing_command_ZIPPROG
+else
+ZIPPROG:=$(firstword $(ZIPPROG))
+endif
+endif
+export ZIPPROG
+ifndef TARPROG
+TARPROG:=$(strip $(wildcard $(addsuffix /gtar$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(TARPROG),)
+TARPROG:=$(strip $(wildcard $(addsuffix /tar$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(TARPROG),)
+TARPROG= __missing_command_TARPROG
+else
+TARPROG:=$(firstword $(TARPROG))
+endif
+else
+TARPROG:=$(firstword $(TARPROG))
+endif
+endif
+export TARPROG
+ASNAME=$(BINUTILSPREFIX)as
+LDNAME=$(BINUTILSPREFIX)ld
+ARNAME=$(BINUTILSPREFIX)ar
+RCNAME=$(BINUTILSPREFIX)rc
+ifndef ASPROG
+ifdef CROSSBINDIR
+ASPROG=$(CROSSBINDIR)/$(ASNAME)$(SRCEXEEXT)
+else
+ASPROG=$(ASNAME)
+endif
+endif
+ifndef LDPROG
+ifdef CROSSBINDIR
+LDPROG=$(CROSSBINDIR)/$(LDNAME)$(SRCEXEEXT)
+else
+LDPROG=$(LDNAME)
+endif
+endif
+ifndef RCPROG
+ifdef CROSSBINDIR
+RCPROG=$(CROSSBINDIR)/$(RCNAME)$(SRCEXEEXT)
+else
+RCPROG=$(RCNAME)
+endif
+endif
+ifndef ARPROG
+ifdef CROSSBINDIR
+ARPROG=$(CROSSBINDIR)/$(ARNAME)$(SRCEXEEXT)
+else
+ARPROG=$(ARNAME)
+endif
+endif
+AS=$(ASPROG)
+LD=$(LDPROG)
+RC=$(RCPROG)
+AR=$(ARPROG)
+PPAS=ppas$(SRCBATCHEXT)
+ifdef inUnix
+LDCONFIG=ldconfig
+else
+LDCONFIG=
+endif
+ifdef DATE
+DATESTR:=$(shell $(DATE) +%Y%m%d)
+else
+DATESTR=
+endif
+ZIPOPT=-9
+ZIPEXT=.zip
+ifeq ($(USETAR),bz2)
+TAROPT=vj
+TAREXT=.tar.bz2
+else
+TAROPT=vz
+TAREXT=.tar.gz
+endif
+override REQUIRE_PACKAGES=rtl 
+ifeq ($(FULL_TARGET),i386-linux)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-go32v2)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-win32)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-os2)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-freebsd)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-beos)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-haiku)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-netbsd)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-solaris)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-qnx)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-netware)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-openbsd)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-wdosx)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-darwin)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-emx)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-watcom)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-netwlibc)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-wince)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-embedded)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-symbian)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-nativent)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-iphonesim)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),m68k-linux)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),m68k-freebsd)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),m68k-netbsd)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),m68k-amiga)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),m68k-atari)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),m68k-openbsd)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),m68k-palmos)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),m68k-embedded)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),powerpc-linux)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),powerpc-netbsd)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),powerpc-amiga)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),powerpc-macos)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),powerpc-darwin)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),powerpc-morphos)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),powerpc-embedded)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),powerpc-wii)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),sparc-linux)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),sparc-netbsd)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),sparc-solaris)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),sparc-embedded)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),x86_64-linux)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),x86_64-freebsd)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),x86_64-netbsd)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),x86_64-solaris)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),x86_64-openbsd)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),x86_64-darwin)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),x86_64-win64)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),x86_64-embedded)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),arm-linux)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),arm-palmos)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),arm-darwin)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),arm-wince)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),arm-gba)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),arm-nds)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),arm-embedded)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),arm-symbian)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),powerpc64-linux)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),powerpc64-darwin)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),powerpc64-embedded)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),avr-embedded)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),armeb-linux)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),armeb-embedded)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),mipsel-linux)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifdef REQUIRE_PACKAGES_RTL
+PACKAGEDIR_RTL:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /rtl/Makefile.fpc,$(PACKAGESDIR))))))
+ifneq ($(PACKAGEDIR_RTL),)
+ifneq ($(wildcard $(PACKAGEDIR_RTL)/units/$(TARGETSUFFIX)),)
+UNITDIR_RTL=$(PACKAGEDIR_RTL)/units/$(TARGETSUFFIX)
+else
+UNITDIR_RTL=$(PACKAGEDIR_RTL)
+endif
+ifneq ($(wildcard $(PACKAGEDIR_RTL)/units/$(SOURCESUFFIX)),)
+UNITDIR_FPMAKE_RTL=$(PACKAGEDIR_RTL)/units/$(SOURCESUFFIX)
+else
+ifneq ($(wildcard $(PACKAGEDIR_RTL)/units_bs/$(SOURCESUFFIX)),)
+UNITDIR_FPMAKE_RTL=$(PACKAGEDIR_RTL)/units_bs/$(SOURCESUFFIX)
+else
+UNITDIR_FPMAKE_RTL=$(PACKAGEDIR_RTL)
+endif
+endif
+ifdef CHECKDEPEND
+$(PACKAGEDIR_RTL)/$(OS_TARGET)/$(FPCMADE):
+	$(MAKE) -C $(PACKAGEDIR_RTL)/$(OS_TARGET) $(FPCMADE)
+override ALLDEPENDENCIES+=$(PACKAGEDIR_RTL)/$(OS_TARGET)/$(FPCMADE)
+endif
+else
+PACKAGEDIR_RTL=
+UNITDIR_RTL:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /rtl/Package.fpc,$(UNITSDIR)))))
+ifneq ($(UNITDIR_RTL),)
+UNITDIR_RTL:=$(firstword $(UNITDIR_RTL))
+else
+UNITDIR_RTL=
+endif
+endif
+ifdef UNITDIR_RTL
+override COMPILER_UNITDIR+=$(UNITDIR_RTL)
+endif
+ifdef UNITDIR_FPMAKE_RTL
+override COMPILER_FPMAKE_UNITDIR+=$(UNITDIR_FPMAKE_RTL)
+endif
+endif
+ifndef NOCPUDEF
+override FPCOPTDEF=$(ARCH)
+endif
+ifneq ($(OS_TARGET),$(OS_SOURCE))
+override FPCOPT+=-T$(OS_TARGET)
+endif
+ifneq ($(CPU_TARGET),$(CPU_SOURCE))
+override FPCOPT+=-P$(ARCH)
+endif
+ifeq ($(OS_SOURCE),openbsd)
+override FPCOPT+=-FD$(NEW_BINUTILS_PATH)
+override FPCMAKEOPT+=-FD$(NEW_BINUTILS_PATH)
+endif
+ifndef CROSSBOOTSTRAP
+ifneq ($(BINUTILSPREFIX),)
+override FPCOPT+=-XP$(BINUTILSPREFIX)
+endif
+ifneq ($(BINUTILSPREFIX),)
+override FPCOPT+=-Xr$(RLINKPATH)
+endif
+endif
+ifndef CROSSCOMPILE
+ifneq ($(BINUTILSPREFIX),)
+override FPCMAKEOPT+=-XP$(BINUTILSPREFIX)
+endif
+endif
+ifdef UNITDIR
+override FPCOPT+=$(addprefix -Fu,$(UNITDIR))
+endif
+ifdef LIBDIR
+override FPCOPT+=$(addprefix -Fl,$(LIBDIR))
+endif
+ifdef OBJDIR
+override FPCOPT+=$(addprefix -Fo,$(OBJDIR))
+endif
+ifdef INCDIR
+override FPCOPT+=$(addprefix -Fi,$(INCDIR))
+endif
+ifdef LINKSMART
+override FPCOPT+=-XX
+endif
+ifdef CREATESMART
+override FPCOPT+=-CX
+endif
+ifdef DEBUG
+override FPCOPT+=-gl
+override FPCOPTDEF+=DEBUG
+endif
+ifdef RELEASE
+ifneq ($(findstring 2.0.,$(FPC_VERSION)),)
+ifeq ($(CPU_TARGET),i386)
+FPCCPUOPT:=-OG2p3
+endif
+ifeq ($(CPU_TARGET),powerpc)
+FPCCPUOPT:=-O1r
+endif
+else
+FPCCPUOPT:=-O2
+endif
+override FPCOPT+=-Ur -Xs $(FPCCPUOPT) -n
+override FPCOPTDEF+=RELEASE
+endif
+ifdef STRIP
+override FPCOPT+=-Xs
+endif
+ifdef OPTIMIZE
+override FPCOPT+=-O2
+endif
+ifdef VERBOSE
+override FPCOPT+=-vwni
+endif
+ifdef COMPILER_OPTIONS
+override FPCOPT+=$(COMPILER_OPTIONS)
+endif
+ifdef COMPILER_UNITDIR
+override FPCOPT+=$(addprefix -Fu,$(COMPILER_UNITDIR))
+endif
+ifdef COMPILER_LIBRARYDIR
+override FPCOPT+=$(addprefix -Fl,$(COMPILER_LIBRARYDIR))
+endif
+ifdef COMPILER_OBJECTDIR
+override FPCOPT+=$(addprefix -Fo,$(COMPILER_OBJECTDIR))
+endif
+ifdef COMPILER_INCLUDEDIR
+override FPCOPT+=$(addprefix -Fi,$(COMPILER_INCLUDEDIR))
+endif
+ifdef CROSSBINDIR
+override FPCOPT+=-FD$(CROSSBINDIR)
+endif
+ifdef COMPILER_TARGETDIR
+override FPCOPT+=-FE$(COMPILER_TARGETDIR)
+ifeq ($(COMPILER_TARGETDIR),.)
+override TARGETDIRPREFIX=
+else
+override TARGETDIRPREFIX=$(COMPILER_TARGETDIR)/
+endif
+endif
+ifdef COMPILER_UNITTARGETDIR
+override FPCOPT+=-FU$(COMPILER_UNITTARGETDIR)
+ifeq ($(COMPILER_UNITTARGETDIR),.)
+override UNITTARGETDIRPREFIX=
+else
+override UNITTARGETDIRPREFIX=$(COMPILER_UNITTARGETDIR)/
+endif
+else
+ifdef COMPILER_TARGETDIR
+override COMPILER_UNITTARGETDIR=$(COMPILER_TARGETDIR)
+override UNITTARGETDIRPREFIX=$(TARGETDIRPREFIX)
+endif
+endif
+ifdef CREATESHARED
+override FPCOPT+=-Cg
+ifeq ($(CPU_TARGET),i386)
+override FPCOPT+=-Aas
+endif
+endif
+ifeq ($(findstring 2.0.,$(FPC_VERSION)),)
+ifneq ($(findstring $(OS_TARGET),freebsd openbsd netbsd linux solaris),)
+ifeq ($(CPU_TARGET),x86_64)
+override FPCOPT+=-Cg
+endif
+endif
+endif
+ifdef LINKSHARED
+endif
+ifdef GCCLIBDIR
+override FPCOPT+=-Fl$(GCCLIBDIR)
+endif
+ifdef OTHERLIBDIR
+override FPCOPT+=$(addprefix -Fl,$(OTHERLIBDIR))
+endif
+ifdef OPT
+override FPCOPT+=$(OPT)
+endif
+ifdef FPCOPTDEF
+override FPCOPT+=$(addprefix -d,$(FPCOPTDEF))
+endif
+ifdef CFGFILE
+override FPCOPT+=@$(CFGFILE)
+endif
+ifdef USEENV
+override FPCEXTCMD:=$(FPCOPT)
+override FPCOPT:=!FPCEXTCMD
+export FPCEXTCMD
+endif
+override AFULL_TARGET=$(CPU_TARGET)-$(OS_TARGET)
+override AFULL_SOURCE=$(CPU_SOURCE)-$(OS_SOURCE)
+ifneq ($(AFULL_TARGET),$(AFULL_SOURCE))
+override ACROSSCOMPILE=1
+endif
+ifdef ACROSSCOMPILE
+override FPCOPT+=$(CROSSOPT)
+endif
+override COMPILER:=$(FPC) $(FPCOPT)
+ifeq (,$(findstring -s ,$(COMPILER)))
+EXECPPAS=
+else
+ifeq ($(FULL_SOURCE),$(FULL_TARGET))
+ifdef RUNBATCH
+EXECPPAS:=@$(RUNBATCH) $(PPAS)
+else
+EXECPPAS:=@$(PPAS)
+endif
+endif
+endif
+.PHONY: fpc_units
+ifneq ($(TARGET_UNITS)$(TARGET_IMPLICITUNITS),)
+override ALLTARGET+=fpc_units
+override UNITPPUFILES=$(addsuffix $(PPUEXT),$(TARGET_UNITS))
+override IMPLICITUNITPPUFILES=$(addsuffix $(PPUEXT),$(TARGET_IMPLICITUNITS))
+override INSTALLPPUFILES+=$(UNITPPUFILES) $(IMPLICITUNITPPUFILES)
+override CLEANPPUFILES+=$(UNITPPUFILES) $(IMPLICITUNITPPUFILES)
+endif
+fpc_units: $(COMPILER_UNITTARGETDIR) $(UNITPPUFILES)
+ifdef TARGET_RSTS
+override RSTFILES=$(addsuffix $(RSTEXT),$(TARGET_RSTS))
+override CLEANRSTFILES+=$(RSTFILES)
+endif
+.PHONY: fpc_examples
+ifneq ($(TARGET_EXAMPLES),)
+HASEXAMPLES=1
+override EXAMPLESOURCEFILES:=$(wildcard $(addsuffix .pp,$(TARGET_EXAMPLES)) $(addsuffix .pas,$(TARGET_EXAMPLES)) $(addsuffix .lpr,$(TARGET_EXAMPLES)) $(addsuffix .dpr,$(TARGET_EXAMPLES)))
+override EXAMPLEFILES:=$(addsuffix $(EXEEXT),$(TARGET_EXAMPLES))
+override EXAMPLEOFILES:=$(addsuffix $(OEXT),$(TARGET_EXAMPLES)) $(addprefix $(STATICLIBPREFIX),$(addsuffix $(STATICLIBEXT),$(TARGET_EXAMPLES))) $(addprefix $(IMPORTLIBPREFIX),$(addsuffix $(STATICLIBEXT),$(TARGET_EXAMPLES)))
+override EXAMPLEDBGFILES:=$(addsuffix $(EXEDBGEXT),$(TARGET_EXAMPLES))
+override CLEANEXEFILES+=$(EXAMPLEFILES) $(EXAMPLEOFILES)
+override CLEANEXEDBGFILES+=$(EXAMPLEDBGFILES)
+ifeq ($(OS_TARGET),os2)
+override CLEANEXEFILES+=$(addsuffix $(AOUTEXT),$(TARGET_EXAMPLES))
+endif
+ifeq ($(OS_TARGET),emx)
+override CLEANEXEFILES+=$(addsuffix $(AOUTEXT),$(TARGET_EXAMPLES))
+endif
+endif
+ifneq ($(TARGET_EXAMPLEDIRS),)
+HASEXAMPLES=1
+endif
+fpc_examples: all $(EXAMPLEFILES) $(addsuffix _all,$(TARGET_EXAMPLEDIRS))
+.PHONY: fpc_all fpc_smart fpc_debug fpc_release fpc_shared
+$(FPCMADE): $(ALLDEPENDENCIES) $(ALLTARGET)
+	@$(ECHOREDIR) Compiled > $(FPCMADE)
+fpc_all: $(FPCMADE)
+fpc_smart:
+	$(MAKE) all LINKSMART=1 CREATESMART=1
+fpc_debug:
+	$(MAKE) all DEBUG=1
+fpc_release:
+	$(MAKE) all RELEASE=1
+.SUFFIXES: $(EXEEXT) $(PPUEXT) $(OEXT) .pas .lpr .dpr .pp .rc .res
+$(COMPILER_UNITTARGETDIR):
+	$(MKDIRTREE) $(COMPILER_UNITTARGETDIR)
+$(COMPILER_TARGETDIR):
+	$(MKDIRTREE) $(COMPILER_TARGETDIR)
+%$(PPUEXT): %.pp
+	$(COMPILER) $<
+	$(EXECPPAS)
+%$(PPUEXT): %.pas
+	$(COMPILER) $<
+	$(EXECPPAS)
+%$(EXEEXT): %.pp
+	$(COMPILER) $<
+	$(EXECPPAS)
+%$(EXEEXT): %.pas
+	$(COMPILER) $<
+	$(EXECPPAS)
+%$(EXEEXT): %.lpr
+	$(COMPILER) $<
+	$(EXECPPAS)
+%$(EXEEXT): %.dpr
+	$(COMPILER) $<
+	$(EXECPPAS)
+%.res: %.rc
+	windres -i $< -o $@
+vpath %.pp $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR)
+vpath %.pas $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR)
+vpath %.lpr $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR)
+vpath %.dpr $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR)
+vpath %.inc $(COMPILER_INCLUDEDIR)
+vpath %$(OEXT) $(COMPILER_UNITTARGETDIR)
+vpath %$(PPUEXT) $(COMPILER_UNITTARGETDIR)
+.PHONY: fpc_shared
+override INSTALLTARGET+=fpc_shared_install
+ifndef SHARED_LIBVERSION
+SHARED_LIBVERSION=$(FPC_VERSION)
+endif
+ifndef SHARED_LIBNAME
+SHARED_LIBNAME=$(PACKAGE_NAME)
+endif
+ifndef SHARED_FULLNAME
+SHARED_FULLNAME=$(SHAREDLIBPREFIX)$(SHARED_LIBNAME)-$(SHARED_LIBVERSION)$(SHAREDLIBEXT)
+endif
+ifndef SHARED_LIBUNITS
+SHARED_LIBUNITS:=$(TARGET_UNITS) $(TARGET_IMPLICITUNITS)
+override SHARED_LIBUNITS:=$(filter-out $(INSTALL_BUILDUNIT),$(SHARED_LIBUNITS))
+endif
+fpc_shared:
+ifdef HASSHAREDLIB
+	$(MAKE) all CREATESHARED=1 LINKSHARED=1 CREATESMART=1
+ifneq ($(SHARED_BUILD),n)
+	$(PPUMOVE) -q $(SHARED_LIBUNITS) -i$(COMPILER_UNITTARGETDIR) -o$(SHARED_FULLNAME) -d$(COMPILER_UNITTARGETDIR)
+endif
+else
+	@$(ECHO) Shared Libraries not supported
+endif
+fpc_shared_install:
+ifneq ($(SHARED_BUILD),n)
+ifneq ($(SHARED_LIBUNITS),)
+ifneq ($(wildcard $(COMPILER_UNITTARGETDIR)/$(SHARED_FULLNAME)),)
+	$(INSTALL) $(COMPILER_UNITTARGETDIR)/$(SHARED_FULLNAME) $(INSTALL_SHAREDDIR)
+endif
+endif
+endif
+.PHONY: fpc_install fpc_sourceinstall fpc_exampleinstall
+ifdef INSTALL_UNITS
+override INSTALLPPUFILES+=$(addsuffix $(PPUEXT),$(INSTALL_UNITS))
+endif
+ifdef INSTALL_BUILDUNIT
+override INSTALLPPUFILES:=$(filter-out $(INSTALL_BUILDUNIT)$(PPUEXT),$(INSTALLPPUFILES))
+endif
+ifdef INSTALLPPUFILES
+override INSTALLPPULINKFILES:=$(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)) $(addprefix $(STATICLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(INSTALLPPUFILES))) $(addprefix $(IMPORTLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(INSTALLPPUFILES)))
+ifneq ($(UNITTARGETDIRPREFIX),)
+override INSTALLPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(notdir $(INSTALLPPUFILES)))
+override INSTALLPPULINKFILES:=$(wildcard $(addprefix $(UNITTARGETDIRPREFIX),$(notdir $(INSTALLPPULINKFILES))))
+endif
+override INSTALL_CREATEPACKAGEFPC=1
+endif
+ifdef INSTALLEXEFILES
+ifneq ($(TARGETDIRPREFIX),)
+override INSTALLEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(notdir $(INSTALLEXEFILES)))
+endif
+endif
+fpc_install: all $(INSTALLTARGET)
+ifdef INSTALLEXEFILES
+	$(MKDIR) $(INSTALL_BINDIR)
+	$(INSTALLEXE) $(INSTALLEXEFILES) $(INSTALL_BINDIR)
+endif
+ifdef INSTALL_CREATEPACKAGEFPC
+ifdef FPCMAKE
+ifdef PACKAGE_VERSION
+ifneq ($(wildcard Makefile.fpc),)
+	$(FPCMAKE) -p -T$(CPU_TARGET)-$(OS_TARGET) Makefile.fpc
+	$(MKDIR) $(INSTALL_UNITDIR)
+	$(INSTALL) Package.fpc $(INSTALL_UNITDIR)
+endif
+endif
+endif
+endif
+ifdef INSTALLPPUFILES
+	$(MKDIR) $(INSTALL_UNITDIR)
+	$(INSTALL) $(INSTALLPPUFILES) $(INSTALL_UNITDIR)
+ifneq ($(INSTALLPPULINKFILES),)
+	$(INSTALL) $(INSTALLPPULINKFILES) $(INSTALL_UNITDIR)
+endif
+ifneq ($(wildcard $(LIB_FULLNAME)),)
+	$(MKDIR) $(INSTALL_LIBDIR)
+	$(INSTALL) $(LIB_FULLNAME) $(INSTALL_LIBDIR)
+ifdef inUnix
+	ln -sf $(LIB_FULLNAME) $(INSTALL_LIBDIR)/$(LIB_NAME)
+endif
+endif
+endif
+ifdef INSTALL_FILES
+	$(MKDIR) $(INSTALL_DATADIR)
+	$(INSTALL) $(INSTALL_FILES) $(INSTALL_DATADIR)
+endif
+fpc_sourceinstall: distclean
+	$(MKDIR) $(INSTALL_SOURCEDIR)
+	$(COPYTREE) $(BASEDIR)/* $(INSTALL_SOURCEDIR)
+fpc_exampleinstall: $(addsuffix _distclean,$(TARGET_EXAMPLEDIRS))
+ifdef HASEXAMPLES
+	$(MKDIR) $(INSTALL_EXAMPLEDIR)
+endif
+ifdef EXAMPLESOURCEFILES
+	$(COPY) $(EXAMPLESOURCEFILES) $(INSTALL_EXAMPLEDIR)
+endif
+ifdef TARGET_EXAMPLEDIRS
+	$(COPYTREE) $(addsuffix /*,$(TARGET_EXAMPLEDIRS)) $(INSTALL_EXAMPLEDIR)
+endif
+.PHONY: fpc_distinstall
+fpc_distinstall: install exampleinstall
+.PHONY: fpc_zipinstall fpc_zipsourceinstall fpc_zipexampleinstall
+ifndef PACKDIR
+ifndef inUnix
+PACKDIR=$(BASEDIR)/../fpc-pack
+else
+PACKDIR=/tmp/fpc-pack
+endif
+endif
+ifndef ZIPNAME
+ifdef DIST_ZIPNAME
+ZIPNAME=$(DIST_ZIPNAME)
+else
+ZIPNAME=$(PACKAGE_NAME)
+endif
+endif
+ifndef FULLZIPNAME
+FULLZIPNAME=$(ZIPCROSSPREFIX)$(ZIPPREFIX)$(ZIPNAME)$(ZIPSUFFIX)
+endif
+ifndef ZIPTARGET
+ifdef DIST_ZIPTARGET
+ZIPTARGET=DIST_ZIPTARGET
+else
+ZIPTARGET=install
+endif
+endif
+ifndef USEZIP
+ifdef inUnix
+USETAR=1
+endif
+endif
+ifndef inUnix
+USEZIPWRAPPER=1
+endif
+ifdef USEZIPWRAPPER
+ZIPPATHSEP=$(PATHSEP)
+ZIPWRAPPER=$(subst /,$(PATHSEP),$(DIST_DESTDIR)/fpczip$(SRCBATCHEXT))
+else
+ZIPPATHSEP=/
+endif
+ZIPCMD_CDPACK:=cd $(subst /,$(ZIPPATHSEP),$(PACKDIR))
+ZIPCMD_CDBASE:=cd $(subst /,$(ZIPPATHSEP),$(BASEDIR))
+ifdef USETAR
+ZIPDESTFILE:=$(DIST_DESTDIR)/$(FULLZIPNAME)$(TAREXT)
+ZIPCMD_ZIP:=$(TARPROG) c$(TAROPT)f $(ZIPDESTFILE) *
+else
+ZIPDESTFILE:=$(DIST_DESTDIR)/$(FULLZIPNAME)$(ZIPEXT)
+ZIPCMD_ZIP:=$(subst /,$(ZIPPATHSEP),$(ZIPPROG)) -Dr $(ZIPOPT) $(ZIPDESTFILE) *
+endif
+fpc_zipinstall:
+	$(MAKE) $(ZIPTARGET) INSTALL_PREFIX=$(PACKDIR) ZIPINSTALL=1
+	$(MKDIR) $(DIST_DESTDIR)
+	$(DEL) $(ZIPDESTFILE)
+ifdef USEZIPWRAPPER
+ifneq ($(ECHOREDIR),echo)
+	$(ECHOREDIR) -e "$(subst \,\\,$(ZIPCMD_CDPACK))" > $(ZIPWRAPPER)
+	$(ECHOREDIR) -e "$(subst \,\\,$(ZIPCMD_ZIP))" >> $(ZIPWRAPPER)
+	$(ECHOREDIR) -e "$(subst \,\\,$(ZIPCMD_CDBASE))" >> $(ZIPWRAPPER)
+else
+	echo $(ZIPCMD_CDPACK) > $(ZIPWRAPPER)
+	echo $(ZIPCMD_ZIP) >> $(ZIPWRAPPER)
+	echo $(ZIPCMD_CDBASE) >> $(ZIPWRAPPER)
+endif
+ifdef inUnix
+	/bin/sh $(ZIPWRAPPER)
+else
+ifdef RUNBATCH
+	$(RUNBATCH) $(ZIPWRAPPER)
+else
+	$(ZIPWRAPPER)
+endif
+endif
+	$(DEL) $(ZIPWRAPPER)
+else
+	$(ZIPCMD_CDPACK) ; $(ZIPCMD_ZIP) ; $(ZIPCMD_CDBASE)
+endif
+	$(DELTREE) $(PACKDIR)
+fpc_zipsourceinstall:
+	$(MAKE) fpc_zipinstall ZIPTARGET=sourceinstall ZIPSUFFIX=$(ZIPSOURCESUFFIX)
+fpc_zipexampleinstall:
+ifdef HASEXAMPLES
+	$(MAKE) fpc_zipinstall ZIPTARGET=exampleinstall ZIPSUFFIX=$(ZIPEXAMPLESUFFIX)
+endif
+fpc_zipdistinstall:
+	$(MAKE) fpc_zipinstall ZIPTARGET=distinstall
+.PHONY: fpc_clean fpc_cleanall fpc_distclean
+ifdef EXEFILES
+override CLEANEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(CLEANEXEFILES))
+override CLEANEXEDBGFILES:=$(addprefix $(TARGETDIRPREFIX),$(CLEANEXEDBGFILES))
+endif
+ifdef CLEAN_PROGRAMS
+override CLEANEXEFILES+=$(addprefix $(TARGETDIRPREFIX),$(addsuffix $(EXEEXT), $(CLEAN_PROGRAMS)))
+override CLEANEXEDBGFILES+=$(addprefix $(TARGETDIRPREFIX),$(addsuffix $(EXEDBGEXT), $(CLEAN_PROGRAMS)))
+endif
+ifdef CLEAN_UNITS
+override CLEANPPUFILES+=$(addsuffix $(PPUEXT),$(CLEAN_UNITS))
+endif
+ifdef CLEANPPUFILES
+override CLEANPPULINKFILES:=$(subst $(PPUEXT),$(OEXT),$(CLEANPPUFILES)) $(addprefix $(STATICLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(CLEANPPUFILES))) $(addprefix $(IMPORTLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(CLEANPPUFILES)))
+ifdef DEBUGSYMEXT
+override CLEANPPULINKFILES+=$(subst $(PPUEXT),$(DEBUGSYMEXT),$(CLEANPPUFILES))
+endif
+override CLEANPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPUFILES))
+override CLEANPPULINKFILES:=$(wildcard $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPULINKFILES)))
+endif
+fpc_clean: $(CLEANTARGET)
+ifdef CLEANEXEFILES
+	-$(DEL) $(CLEANEXEFILES)
+endif
+ifdef CLEANEXEDBGFILES
+	-$(DELTREE) $(CLEANEXEDBGFILES)
+endif
+ifdef CLEANPPUFILES
+	-$(DEL) $(CLEANPPUFILES)
+endif
+ifneq ($(CLEANPPULINKFILES),)
+	-$(DEL) $(CLEANPPULINKFILES)
+endif
+ifdef CLEANRSTFILES
+	-$(DEL) $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANRSTFILES))
+endif
+ifdef CLEAN_FILES
+	-$(DEL) $(CLEAN_FILES)
+endif
+ifdef LIB_NAME
+	-$(DEL) $(LIB_NAME) $(LIB_FULLNAME)
+endif
+	-$(DEL) $(FPCMADE) Package.fpc $(PPAS) script.res link.res $(FPCEXTFILE) $(REDIRFILE)
+	-$(DEL) *$(ASMEXT) *_ppas$(BATCHEXT)
+fpc_cleanall: $(CLEANTARGET)
+ifdef CLEANEXEFILES
+	-$(DEL) $(CLEANEXEFILES)
+endif
+ifdef COMPILER_UNITTARGETDIR
+ifdef CLEANPPUFILES
+	-$(DEL) $(CLEANPPUFILES)
+endif
+ifneq ($(CLEANPPULINKFILES),)
+	-$(DEL) $(CLEANPPULINKFILES)
+endif
+ifdef CLEANRSTFILES
+	-$(DEL) $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANRSTFILES))
+endif
+endif
+ifdef CLEAN_FILES
+	-$(DEL) $(CLEAN_FILES)
+endif
+	-$(DELTREE) units
+	-$(DEL) *$(OEXT) *$(PPUEXT) *$(RSTEXT) *$(ASMEXT) *$(STATICLIBEXT) *$(SHAREDLIBEXT) *$(PPLEXT)
+ifneq ($(PPUEXT),.ppu)
+	-$(DEL) *.o *.ppu *.a
+endif
+	-$(DELTREE) *$(SMARTEXT)
+	-$(DEL) fpcmade.* Package.fpc $(PPAS) script.res link.res $(FPCEXTFILE) $(REDIRFILE)
+	-$(DEL) *_ppas$(BATCHEXT)
+ifdef AOUTEXT
+	-$(DEL) *$(AOUTEXT)
+endif
+ifdef DEBUGSYMEXT
+	-$(DEL) *$(DEBUGSYMEXT)
+endif
+fpc_distclean: cleanall
+.PHONY: fpc_baseinfo
+override INFORULES+=fpc_baseinfo
+fpc_baseinfo:
+	@$(ECHO)
+	@$(ECHO)  == Package info ==
+	@$(ECHO)  Package Name..... $(PACKAGE_NAME)
+	@$(ECHO)  Package Version.. $(PACKAGE_VERSION)
+	@$(ECHO)
+	@$(ECHO)  == Configuration info ==
+	@$(ECHO)
+	@$(ECHO)  FPC.......... $(FPC)
+	@$(ECHO)  FPC Version.. $(FPC_VERSION)
+	@$(ECHO)  Source CPU... $(CPU_SOURCE)
+	@$(ECHO)  Target CPU... $(CPU_TARGET)
+	@$(ECHO)  Source OS.... $(OS_SOURCE)
+	@$(ECHO)  Target OS.... $(OS_TARGET)
+	@$(ECHO)  Full Source.. $(FULL_SOURCE)
+	@$(ECHO)  Full Target.. $(FULL_TARGET)
+	@$(ECHO)  SourceSuffix. $(SOURCESUFFIX)
+	@$(ECHO)  TargetSuffix. $(TARGETSUFFIX)
+	@$(ECHO)  FPC fpmake... $(FPCFPMAKE)
+	@$(ECHO)
+	@$(ECHO)  == Directory info ==
+	@$(ECHO)
+	@$(ECHO)  Required pkgs... $(REQUIRE_PACKAGES)
+	@$(ECHO)
+	@$(ECHO)  Basedir......... $(BASEDIR)
+	@$(ECHO)  FPCDir.......... $(FPCDIR)
+	@$(ECHO)  CrossBinDir..... $(CROSSBINDIR)
+	@$(ECHO)  UnitsDir........ $(UNITSDIR)
+	@$(ECHO)  PackagesDir..... $(PACKAGESDIR)
+	@$(ECHO)
+	@$(ECHO)  GCC library..... $(GCCLIBDIR)
+	@$(ECHO)  Other library... $(OTHERLIBDIR)
+	@$(ECHO)
+	@$(ECHO)  == Tools info ==
+	@$(ECHO)
+	@$(ECHO)  As........ $(AS)
+	@$(ECHO)  Ld........ $(LD)
+	@$(ECHO)  Ar........ $(AR)
+	@$(ECHO)  Rc........ $(RC)
+	@$(ECHO)
+	@$(ECHO)  Mv........ $(MVPROG)
+	@$(ECHO)  Cp........ $(CPPROG)
+	@$(ECHO)  Rm........ $(RMPROG)
+	@$(ECHO)  GInstall.. $(GINSTALL)
+	@$(ECHO)  Echo...... $(ECHO)
+	@$(ECHO)  Shell..... $(SHELL)
+	@$(ECHO)  Date...... $(DATE)
+	@$(ECHO)  FPCMake... $(FPCMAKE)
+	@$(ECHO)  PPUMove... $(PPUMOVE)
+	@$(ECHO)  Zip....... $(ZIPPROG)
+	@$(ECHO)
+	@$(ECHO)  == Object info ==
+	@$(ECHO)
+	@$(ECHO)  Target Loaders........ $(TARGET_LOADERS)
+	@$(ECHO)  Target Units.......... $(TARGET_UNITS)
+	@$(ECHO)  Target Implicit Units. $(TARGET_IMPLICITUNITS)
+	@$(ECHO)  Target Programs....... $(TARGET_PROGRAMS)
+	@$(ECHO)  Target Dirs........... $(TARGET_DIRS)
+	@$(ECHO)  Target Examples....... $(TARGET_EXAMPLES)
+	@$(ECHO)  Target ExampleDirs.... $(TARGET_EXAMPLEDIRS)
+	@$(ECHO)
+	@$(ECHO)  Clean Units......... $(CLEAN_UNITS)
+	@$(ECHO)  Clean Files......... $(CLEAN_FILES)
+	@$(ECHO)
+	@$(ECHO)  Install Units....... $(INSTALL_UNITS)
+	@$(ECHO)  Install Files....... $(INSTALL_FILES)
+	@$(ECHO)
+	@$(ECHO)  == Install info ==
+	@$(ECHO)
+	@$(ECHO)  DateStr.............. $(DATESTR)
+	@$(ECHO)  ZipName.............. $(ZIPNAME)
+	@$(ECHO)  ZipPrefix............ $(ZIPPREFIX)
+	@$(ECHO)  ZipCrossPrefix....... $(ZIPCROSSPREFIX)
+	@$(ECHO)  ZipSuffix............ $(ZIPSUFFIX)
+	@$(ECHO)  FullZipName.......... $(FULLZIPNAME)
+	@$(ECHO)  Install FPC Package.. $(INSTALL_FPCPACKAGE)
+	@$(ECHO)
+	@$(ECHO)  Install base dir..... $(INSTALL_BASEDIR)
+	@$(ECHO)  Install binary dir... $(INSTALL_BINDIR)
+	@$(ECHO)  Install library dir.. $(INSTALL_LIBDIR)
+	@$(ECHO)  Install units dir.... $(INSTALL_UNITDIR)
+	@$(ECHO)  Install source dir... $(INSTALL_SOURCEDIR)
+	@$(ECHO)  Install doc dir...... $(INSTALL_DOCDIR)
+	@$(ECHO)  Install example dir.. $(INSTALL_EXAMPLEDIR)
+	@$(ECHO)  Install data dir..... $(INSTALL_DATADIR)
+	@$(ECHO)
+	@$(ECHO)  Dist destination dir. $(DIST_DESTDIR)
+	@$(ECHO)  Dist zip name........ $(DIST_ZIPNAME)
+	@$(ECHO)
+.PHONY: fpc_info
+fpc_info: $(INFORULES)
+.PHONY: fpc_makefile fpc_makefiles fpc_makefile_sub1 fpc_makefile_sub2 \
+	fpc_makefile_dirs
+fpc_makefile:
+	$(FPCMAKE) -w -T$(OS_TARGET) Makefile.fpc
+fpc_makefile_sub1:
+ifdef TARGET_DIRS
+	$(FPCMAKE) -w -T$(OS_TARGET) $(addsuffix /Makefile.fpc,$(TARGET_DIRS))
+endif
+ifdef TARGET_EXAMPLEDIRS
+	$(FPCMAKE) -w -T$(OS_TARGET) $(addsuffix /Makefile.fpc,$(TARGET_EXAMPLEDIRS))
+endif
+fpc_makefile_sub2: $(addsuffix _makefile_dirs,$(TARGET_DIRS) $(TARGET_EXAMPLEDIRS))
+fpc_makefile_dirs: fpc_makefile_sub1 fpc_makefile_sub2
+fpc_makefiles: fpc_makefile fpc_makefile_dirs
+ifeq ($(FULL_TARGET),i386-linux)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),i386-go32v2)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),i386-win32)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),i386-os2)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),i386-freebsd)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),i386-beos)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),i386-haiku)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),i386-netbsd)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),i386-solaris)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),i386-qnx)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),i386-netware)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),i386-openbsd)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),i386-wdosx)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),i386-darwin)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),i386-emx)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),i386-watcom)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),i386-netwlibc)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),i386-wince)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),i386-embedded)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),i386-symbian)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),i386-nativent)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),i386-iphonesim)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),m68k-linux)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),m68k-freebsd)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),m68k-netbsd)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),m68k-amiga)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),m68k-atari)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),m68k-openbsd)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),m68k-palmos)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),m68k-embedded)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),powerpc-linux)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),powerpc-netbsd)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),powerpc-amiga)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),powerpc-macos)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),powerpc-darwin)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),powerpc-morphos)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),powerpc-embedded)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),powerpc-wii)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),sparc-linux)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),sparc-netbsd)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),sparc-solaris)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),sparc-embedded)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),x86_64-linux)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),x86_64-freebsd)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),x86_64-netbsd)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),x86_64-solaris)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),x86_64-openbsd)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),x86_64-darwin)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),x86_64-win64)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),x86_64-embedded)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),arm-linux)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),arm-palmos)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),arm-darwin)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),arm-wince)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),arm-gba)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),arm-nds)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),arm-embedded)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),arm-symbian)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),powerpc64-linux)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),powerpc64-darwin)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),powerpc64-embedded)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),avr-embedded)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),armeb-linux)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),armeb-embedded)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),mipsel-linux)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifdef TARGET_EXAMPLEDIRS_EXAMPLES
+examples_all:
+	$(MAKE) -C examples all
+examples_debug:
+	$(MAKE) -C examples debug
+examples_smart:
+	$(MAKE) -C examples smart
+examples_release:
+	$(MAKE) -C examples release
+examples_units:
+	$(MAKE) -C examples units
+examples_examples:
+	$(MAKE) -C examples examples
+examples_shared:
+	$(MAKE) -C examples shared
+examples_install:
+	$(MAKE) -C examples install
+examples_sourceinstall:
+	$(MAKE) -C examples sourceinstall
+examples_exampleinstall:
+	$(MAKE) -C examples exampleinstall
+examples_distinstall:
+	$(MAKE) -C examples distinstall
+examples_zipinstall:
+	$(MAKE) -C examples zipinstall
+examples_zipsourceinstall:
+	$(MAKE) -C examples zipsourceinstall
+examples_zipexampleinstall:
+	$(MAKE) -C examples zipexampleinstall
+examples_zipdistinstall:
+	$(MAKE) -C examples zipdistinstall
+examples_clean:
+	$(MAKE) -C examples clean
+examples_distclean:
+	$(MAKE) -C examples distclean
+examples_cleanall:
+	$(MAKE) -C examples cleanall
+examples_info:
+	$(MAKE) -C examples info
+examples_makefiles:
+	$(MAKE) -C examples makefiles
+examples:
+	$(MAKE) -C examples all
+.PHONY: examples_all examples_debug examples_smart examples_release examples_units examples_examples examples_shared examples_install examples_sourceinstall examples_exampleinstall examples_distinstall examples_zipinstall examples_zipsourceinstall examples_zipexampleinstall examples_zipdistinstall examples_clean examples_distclean examples_cleanall examples_info examples_makefiles examples
+endif
+all: fpc_all
+debug: fpc_debug
+smart: fpc_smart
+release: fpc_release
+units: fpc_units
+examples: fpc_examples
+shared: fpc_shared
+install: fpc_install
+sourceinstall: fpc_sourceinstall
+exampleinstall: fpc_exampleinstall
+distinstall: fpc_distinstall
+zipinstall: fpc_zipinstall
+zipsourceinstall: fpc_zipsourceinstall
+zipexampleinstall: fpc_zipexampleinstall
+zipdistinstall: fpc_zipdistinstall
+clean: fpc_clean $(addsuffix _clean,$(TARGET_EXAMPLEDIRS))
+distclean: fpc_distclean
+cleanall: fpc_cleanall
+info: fpc_info
+makefiles: fpc_makefiles
+.PHONY: all debug smart release units examples shared install sourceinstall exampleinstall distinstall zipinstall zipsourceinstall zipexampleinstall zipdistinstall clean distclean cleanall info makefiles
+ifneq ($(wildcard fpcmake.loc),)
+include fpcmake.loc
+endif
+.NOTPARALLEL:
+httpd24($PPUEXT):	src/apr/apr24.pas

+ 28 - 0
packages/httpd24/Makefile.fpc

@@ -0,0 +1,28 @@
+#
+#  Makefile.fpc for httpd 2.2 unit
+#
+
+[package]
+name=httpd24 
+version=2.6.3
+
+[target]
+units=apr24 httpd24 
+exampledirs=examples
+
+[require]
+libc=y
+
+[install]
+fpcpackage=y
+
+[default]
+fpcdir=../..
+
+[compiler]
+includedir=src src/apr src/aprutil
+sourcedir=src tests src/apr src/aprutil
+
+[rules]
+.NOTPARALLEL:
+httpd24($PPUEXT):	src/apr/apr24.pas

+ 2411 - 0
packages/httpd24/examples/Makefile

@@ -0,0 +1,2411 @@
+#
+# Don't edit, this file is generated by FPCMake Version 2.0.0 [2012/04/25]
+#
+default: all
+MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian i386-nativent i386-iphonesim m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos m68k-embedded powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos powerpc-darwin powerpc-morphos powerpc-embedded powerpc-wii powerpc-aix sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-netbsd x86_64-solaris x86_64-openbsd x86_64-darwin x86_64-win64 x86_64-embedded arm-linux arm-palmos arm-darwin arm-wince arm-gba arm-nds arm-embedded arm-symbian powerpc64-linux powerpc64-darwin powerpc64-embedded powerpc64-aix avr-embedded armeb-linux armeb-embedded mips-linux mipsel-linux
+BSDs = freebsd netbsd openbsd darwin
+UNIXs = linux $(BSDs) solaris qnx haiku aix
+LIMIT83fs = go32v2 os2 emx watcom
+OSNeedsComspecToRunBatch = go32v2 watcom
+FORCE:
+.PHONY: FORCE
+override PATH:=$(patsubst %/,%,$(subst \,/,$(PATH)))
+ifneq ($(findstring darwin,$(OSTYPE)),)
+inUnix=1 #darwin
+SEARCHPATH:=$(filter-out .,$(subst :, ,$(PATH)))
+else
+ifeq ($(findstring ;,$(PATH)),)
+inUnix=1
+SEARCHPATH:=$(filter-out .,$(subst :, ,$(PATH)))
+else
+SEARCHPATH:=$(subst ;, ,$(PATH))
+endif
+endif
+SEARCHPATH+=$(patsubst %/,%,$(subst \,/,$(dir $(MAKE))))
+PWD:=$(strip $(wildcard $(addsuffix /pwd.exe,$(SEARCHPATH))))
+ifeq ($(PWD),)
+PWD:=$(strip $(wildcard $(addsuffix /pwd,$(SEARCHPATH))))
+ifeq ($(PWD),)
+$(error You need the GNU utils package to use this Makefile)
+else
+PWD:=$(firstword $(PWD))
+SRCEXEEXT=
+endif
+else
+PWD:=$(firstword $(PWD))
+SRCEXEEXT=.exe
+endif
+ifndef inUnix
+ifeq ($(OS),Windows_NT)
+inWinNT=1
+else
+ifdef OS2_SHELL
+inOS2=1
+endif
+endif
+else
+ifneq ($(findstring cygdrive,$(PATH)),)
+inCygWin=1
+endif
+endif
+ifdef inUnix
+SRCBATCHEXT=.sh
+else
+ifdef inOS2
+SRCBATCHEXT=.cmd
+else
+SRCBATCHEXT=.bat
+endif
+endif
+ifdef COMSPEC
+ifneq ($(findstring $(OS_SOURCE),$(OSNeedsComspecToRunBatch)),)
+ifndef RUNBATCH
+RUNBATCH=$(COMSPEC) /C
+endif
+endif
+endif
+ifdef inUnix
+PATHSEP=/
+else
+PATHSEP:=$(subst /,\,/)
+ifdef inCygWin
+PATHSEP=/
+endif
+endif
+ifdef PWD
+BASEDIR:=$(subst \,/,$(shell $(PWD)))
+ifdef inCygWin
+ifneq ($(findstring /cygdrive/,$(BASEDIR)),)
+BASENODIR:=$(patsubst /cygdrive%,%,$(BASEDIR))
+BASEDRIVE:=$(firstword $(subst /, ,$(BASENODIR)))
+BASEDIR:=$(subst /cygdrive/$(BASEDRIVE)/,$(BASEDRIVE):/,$(BASEDIR))
+endif
+endif
+else
+BASEDIR=.
+endif
+ifdef inOS2
+ifndef ECHO
+ECHO:=$(strip $(wildcard $(addsuffix /gecho$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(ECHO),)
+ECHO:=$(strip $(wildcard $(addsuffix /echo$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(ECHO),)
+ECHO=echo
+else
+ECHO:=$(firstword $(ECHO))
+endif
+else
+ECHO:=$(firstword $(ECHO))
+endif
+endif
+export ECHO
+endif
+override DEFAULT_FPCDIR=../../..
+ifndef FPC
+ifdef PP
+FPC=$(PP)
+endif
+endif
+ifndef FPC
+FPCPROG:=$(strip $(wildcard $(addsuffix /fpc$(SRCEXEEXT),$(SEARCHPATH))))
+ifneq ($(FPCPROG),)
+FPCPROG:=$(firstword $(FPCPROG))
+ifneq ($(CPU_TARGET),)
+FPC:=$(shell $(FPCPROG) -P$(CPU_TARGET) -PB)
+else
+FPC:=$(shell $(FPCPROG) -PB)
+endif
+ifneq ($(findstring Error,$(FPC)),)
+override FPC=$(firstword $(strip $(wildcard $(addsuffix /ppc386$(SRCEXEEXT),$(SEARCHPATH)))))
+else
+ifeq ($(strip $(wildcard $(FPC))),)
+FPC:=$(firstword $(FPCPROG))
+endif
+endif
+else
+override FPC=$(firstword $(strip $(wildcard $(addsuffix /ppc386$(SRCEXEEXT),$(SEARCHPATH)))))
+endif
+endif
+override FPC:=$(subst $(SRCEXEEXT),,$(FPC))
+override FPC:=$(subst \,/,$(FPC))$(SRCEXEEXT)
+FOUNDFPC:=$(strip $(wildcard $(FPC)))
+ifeq ($(FOUNDFPC),)
+FOUNDFPC=$(strip $(wildcard $(addsuffix /$(FPC),$(SEARCHPATH))))
+ifeq ($(FOUNDFPC),)
+$(error Compiler $(FPC) not found)
+endif
+endif
+ifndef FPC_COMPILERINFO
+FPC_COMPILERINFO:=$(shell $(FPC) -iVSPTPSOTO)
+endif
+ifndef FPC_VERSION
+FPC_VERSION:=$(word 1,$(FPC_COMPILERINFO))
+endif
+export FPC FPC_VERSION FPC_COMPILERINFO
+unexport CHECKDEPEND ALLDEPENDENCIES
+ifndef CPU_TARGET
+ifdef CPU_TARGET_DEFAULT
+CPU_TARGET=$(CPU_TARGET_DEFAULT)
+endif
+endif
+ifndef OS_TARGET
+ifdef OS_TARGET_DEFAULT
+OS_TARGET=$(OS_TARGET_DEFAULT)
+endif
+endif
+ifndef CPU_SOURCE
+CPU_SOURCE:=$(word 2,$(FPC_COMPILERINFO))
+endif
+ifndef CPU_TARGET
+CPU_TARGET:=$(word 3,$(FPC_COMPILERINFO))
+endif
+ifndef OS_SOURCE
+OS_SOURCE:=$(word 4,$(FPC_COMPILERINFO))
+endif
+ifndef OS_TARGET
+OS_TARGET:=$(word 5,$(FPC_COMPILERINFO))
+endif
+FULL_TARGET=$(CPU_TARGET)-$(OS_TARGET)
+FULL_SOURCE=$(CPU_SOURCE)-$(OS_SOURCE)
+ifeq ($(CPU_TARGET),armeb)
+ARCH=arm
+override FPCOPT+=-Cb
+else
+ifeq ($(CPU_TARGET),armel)
+ARCH=arm
+override FPCOPT+=-CaEABI
+else
+ARCH=$(CPU_TARGET)
+endif
+endif
+ifeq ($(FULL_TARGET),arm-embedded)
+ifeq ($(SUBARCH),)
+$(error When compiling for arm-embedded, a sub-architecture (e.g. SUBARCH=armv4t or SUBARCH=armv7m) must be defined)
+endif
+override FPCOPT+=-Cp$(SUBARCH)
+endif
+ifneq ($(findstring $(OS_SOURCE),$(LIMIT83fs)),)
+TARGETSUFFIX=$(OS_TARGET)
+SOURCESUFFIX=$(OS_SOURCE)
+else
+ifneq ($(findstring $(OS_TARGET),$(LIMIT83fs)),)
+TARGETSUFFIX=$(OS_TARGET)
+else
+TARGETSUFFIX=$(FULL_TARGET)
+endif
+SOURCESUFFIX=$(FULL_SOURCE)
+endif
+ifneq ($(FULL_TARGET),$(FULL_SOURCE))
+CROSSCOMPILE=1
+endif
+ifeq ($(findstring makefile,$(MAKECMDGOALS)),)
+ifeq ($(findstring $(FULL_TARGET),$(MAKEFILETARGETS)),)
+$(error The Makefile doesn't support target $(FULL_TARGET), please run fpcmake first)
+endif
+endif
+ifneq ($(findstring $(OS_TARGET),$(BSDs)),)
+BSDhier=1
+endif
+ifeq ($(OS_TARGET),linux)
+linuxHier=1
+endif
+export OS_TARGET OS_SOURCE ARCH CPU_TARGET CPU_SOURCE FULL_TARGET FULL_SOURCE TARGETSUFFIX SOURCESUFFIX CROSSCOMPILE
+ifdef FPCDIR
+override FPCDIR:=$(subst \,/,$(FPCDIR))
+ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),)
+override FPCDIR=wrong
+endif
+else
+override FPCDIR=wrong
+endif
+ifdef DEFAULT_FPCDIR
+ifeq ($(FPCDIR),wrong)
+override FPCDIR:=$(subst \,/,$(DEFAULT_FPCDIR))
+ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),)
+override FPCDIR=wrong
+endif
+endif
+endif
+ifeq ($(FPCDIR),wrong)
+ifdef inUnix
+override FPCDIR=/usr/local/lib/fpc/$(FPC_VERSION)
+ifeq ($(wildcard $(FPCDIR)/units),)
+override FPCDIR=/usr/lib/fpc/$(FPC_VERSION)
+endif
+else
+override FPCDIR:=$(subst /$(FPC),,$(firstword $(strip $(wildcard $(addsuffix /$(FPC),$(SEARCHPATH))))))
+override FPCDIR:=$(FPCDIR)/..
+ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),)
+override FPCDIR:=$(FPCDIR)/..
+ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),)
+override FPCDIR:=$(BASEDIR)
+ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),)
+override FPCDIR=c:/pp
+endif
+endif
+endif
+endif
+endif
+ifndef CROSSBINDIR
+CROSSBINDIR:=$(wildcard $(FPCDIR)/bin/$(TARGETSUFFIX))
+endif
+ifneq ($(findstring $(OS_TARGET),darwin iphonesim),)
+ifeq ($(OS_SOURCE),darwin)
+DARWIN2DARWIN=1
+endif
+endif
+ifndef BINUTILSPREFIX
+ifndef CROSSBINDIR
+ifdef CROSSCOMPILE
+ifndef DARWIN2DARWIN
+BINUTILSPREFIX=$(CPU_TARGET)-$(OS_TARGET)-
+endif
+endif
+endif
+endif
+UNITSDIR:=$(wildcard $(FPCDIR)/units/$(TARGETSUFFIX))
+ifeq ($(UNITSDIR),)
+UNITSDIR:=$(wildcard $(FPCDIR)/units/$(OS_TARGET))
+endif
+PACKAGESDIR:=$(wildcard $(FPCDIR) $(FPCDIR)/packages $(FPCDIR)/packages/base $(FPCDIR)/packages/extra)
+ifndef FPCFPMAKE
+ifdef CROSSCOMPILE
+ifeq ($(strip $(wildcard $(addsuffix /compiler/ppc$(SRCEXEEXT),$(FPCDIR)))),)
+FPCPROG:=$(strip $(wildcard $(addsuffix /fpc$(SRCEXEEXT),$(SEARCHPATH))))
+ifneq ($(FPCPROG),)
+FPCPROG:=$(firstword $(FPCPROG))
+FPCFPMAKE:=$(shell $(FPCPROG) -PB)
+ifeq ($(strip $(wildcard $(FPCFPMAKE))),)
+FPCFPMAKE:=$(firstword $(FPCPROG))
+endif
+else
+override FPCFPMAKE=$(firstword $(strip $(wildcard $(addsuffix /ppc386$(SRCEXEEXT),$(SEARCHPATH)))))
+endif
+else
+FPCFPMAKE=$(strip $(wildcard $(addsuffix /compiler/ppc$(SRCEXEEXT),$(FPCDIR))))
+FPMAKE_SKIP_CONFIG=-n
+export FPCFPMAKE
+export FPMAKE_SKIP_CONFIG
+endif
+else
+FPMAKE_SKIP_CONFIG=-n
+FPCFPMAKE=$(FPC)
+endif
+endif
+ifeq ($(FULL_TARGET),i386-linux)
+override TARGET_PROGRAMS+=mod_hello
+endif
+ifeq ($(FULL_TARGET),i386-go32v2)
+override TARGET_PROGRAMS+=mod_hello
+endif
+ifeq ($(FULL_TARGET),i386-win32)
+override TARGET_PROGRAMS+=mod_hello
+endif
+ifeq ($(FULL_TARGET),i386-os2)
+override TARGET_PROGRAMS+=mod_hello
+endif
+ifeq ($(FULL_TARGET),i386-freebsd)
+override TARGET_PROGRAMS+=mod_hello
+endif
+ifeq ($(FULL_TARGET),i386-beos)
+override TARGET_PROGRAMS+=mod_hello
+endif
+ifeq ($(FULL_TARGET),i386-haiku)
+override TARGET_PROGRAMS+=mod_hello
+endif
+ifeq ($(FULL_TARGET),i386-netbsd)
+override TARGET_PROGRAMS+=mod_hello
+endif
+ifeq ($(FULL_TARGET),i386-solaris)
+override TARGET_PROGRAMS+=mod_hello
+endif
+ifeq ($(FULL_TARGET),i386-qnx)
+override TARGET_PROGRAMS+=mod_hello
+endif
+ifeq ($(FULL_TARGET),i386-netware)
+override TARGET_PROGRAMS+=mod_hello
+endif
+ifeq ($(FULL_TARGET),i386-openbsd)
+override TARGET_PROGRAMS+=mod_hello
+endif
+ifeq ($(FULL_TARGET),i386-wdosx)
+override TARGET_PROGRAMS+=mod_hello
+endif
+ifeq ($(FULL_TARGET),i386-darwin)
+override TARGET_PROGRAMS+=mod_hello
+endif
+ifeq ($(FULL_TARGET),i386-emx)
+override TARGET_PROGRAMS+=mod_hello
+endif
+ifeq ($(FULL_TARGET),i386-watcom)
+override TARGET_PROGRAMS+=mod_hello
+endif
+ifeq ($(FULL_TARGET),i386-netwlibc)
+override TARGET_PROGRAMS+=mod_hello
+endif
+ifeq ($(FULL_TARGET),i386-wince)
+override TARGET_PROGRAMS+=mod_hello
+endif
+ifeq ($(FULL_TARGET),i386-embedded)
+override TARGET_PROGRAMS+=mod_hello
+endif
+ifeq ($(FULL_TARGET),i386-symbian)
+override TARGET_PROGRAMS+=mod_hello
+endif
+ifeq ($(FULL_TARGET),i386-nativent)
+override TARGET_PROGRAMS+=mod_hello
+endif
+ifeq ($(FULL_TARGET),i386-iphonesim)
+override TARGET_PROGRAMS+=mod_hello
+endif
+ifeq ($(FULL_TARGET),m68k-linux)
+override TARGET_PROGRAMS+=mod_hello
+endif
+ifeq ($(FULL_TARGET),m68k-freebsd)
+override TARGET_PROGRAMS+=mod_hello
+endif
+ifeq ($(FULL_TARGET),m68k-netbsd)
+override TARGET_PROGRAMS+=mod_hello
+endif
+ifeq ($(FULL_TARGET),m68k-amiga)
+override TARGET_PROGRAMS+=mod_hello
+endif
+ifeq ($(FULL_TARGET),m68k-atari)
+override TARGET_PROGRAMS+=mod_hello
+endif
+ifeq ($(FULL_TARGET),m68k-openbsd)
+override TARGET_PROGRAMS+=mod_hello
+endif
+ifeq ($(FULL_TARGET),m68k-palmos)
+override TARGET_PROGRAMS+=mod_hello
+endif
+ifeq ($(FULL_TARGET),m68k-embedded)
+override TARGET_PROGRAMS+=mod_hello
+endif
+ifeq ($(FULL_TARGET),powerpc-linux)
+override TARGET_PROGRAMS+=mod_hello
+endif
+ifeq ($(FULL_TARGET),powerpc-netbsd)
+override TARGET_PROGRAMS+=mod_hello
+endif
+ifeq ($(FULL_TARGET),powerpc-amiga)
+override TARGET_PROGRAMS+=mod_hello
+endif
+ifeq ($(FULL_TARGET),powerpc-macos)
+override TARGET_PROGRAMS+=mod_hello
+endif
+ifeq ($(FULL_TARGET),powerpc-darwin)
+override TARGET_PROGRAMS+=mod_hello
+endif
+ifeq ($(FULL_TARGET),powerpc-morphos)
+override TARGET_PROGRAMS+=mod_hello
+endif
+ifeq ($(FULL_TARGET),powerpc-embedded)
+override TARGET_PROGRAMS+=mod_hello
+endif
+ifeq ($(FULL_TARGET),powerpc-wii)
+override TARGET_PROGRAMS+=mod_hello
+endif
+ifeq ($(FULL_TARGET),powerpc-aix)
+override TARGET_PROGRAMS+=mod_hello
+endif
+ifeq ($(FULL_TARGET),sparc-linux)
+override TARGET_PROGRAMS+=mod_hello
+endif
+ifeq ($(FULL_TARGET),sparc-netbsd)
+override TARGET_PROGRAMS+=mod_hello
+endif
+ifeq ($(FULL_TARGET),sparc-solaris)
+override TARGET_PROGRAMS+=mod_hello
+endif
+ifeq ($(FULL_TARGET),sparc-embedded)
+override TARGET_PROGRAMS+=mod_hello
+endif
+ifeq ($(FULL_TARGET),x86_64-linux)
+override TARGET_PROGRAMS+=mod_hello
+endif
+ifeq ($(FULL_TARGET),x86_64-freebsd)
+override TARGET_PROGRAMS+=mod_hello
+endif
+ifeq ($(FULL_TARGET),x86_64-netbsd)
+override TARGET_PROGRAMS+=mod_hello
+endif
+ifeq ($(FULL_TARGET),x86_64-solaris)
+override TARGET_PROGRAMS+=mod_hello
+endif
+ifeq ($(FULL_TARGET),x86_64-openbsd)
+override TARGET_PROGRAMS+=mod_hello
+endif
+ifeq ($(FULL_TARGET),x86_64-darwin)
+override TARGET_PROGRAMS+=mod_hello
+endif
+ifeq ($(FULL_TARGET),x86_64-win64)
+override TARGET_PROGRAMS+=mod_hello
+endif
+ifeq ($(FULL_TARGET),x86_64-embedded)
+override TARGET_PROGRAMS+=mod_hello
+endif
+ifeq ($(FULL_TARGET),arm-linux)
+override TARGET_PROGRAMS+=mod_hello
+endif
+ifeq ($(FULL_TARGET),arm-palmos)
+override TARGET_PROGRAMS+=mod_hello
+endif
+ifeq ($(FULL_TARGET),arm-darwin)
+override TARGET_PROGRAMS+=mod_hello
+endif
+ifeq ($(FULL_TARGET),arm-wince)
+override TARGET_PROGRAMS+=mod_hello
+endif
+ifeq ($(FULL_TARGET),arm-gba)
+override TARGET_PROGRAMS+=mod_hello
+endif
+ifeq ($(FULL_TARGET),arm-nds)
+override TARGET_PROGRAMS+=mod_hello
+endif
+ifeq ($(FULL_TARGET),arm-embedded)
+override TARGET_PROGRAMS+=mod_hello
+endif
+ifeq ($(FULL_TARGET),arm-symbian)
+override TARGET_PROGRAMS+=mod_hello
+endif
+ifeq ($(FULL_TARGET),powerpc64-linux)
+override TARGET_PROGRAMS+=mod_hello
+endif
+ifeq ($(FULL_TARGET),powerpc64-darwin)
+override TARGET_PROGRAMS+=mod_hello
+endif
+ifeq ($(FULL_TARGET),powerpc64-embedded)
+override TARGET_PROGRAMS+=mod_hello
+endif
+ifeq ($(FULL_TARGET),powerpc64-aix)
+override TARGET_PROGRAMS+=mod_hello
+endif
+ifeq ($(FULL_TARGET),avr-embedded)
+override TARGET_PROGRAMS+=mod_hello
+endif
+ifeq ($(FULL_TARGET),armeb-linux)
+override TARGET_PROGRAMS+=mod_hello
+endif
+ifeq ($(FULL_TARGET),armeb-embedded)
+override TARGET_PROGRAMS+=mod_hello
+endif
+ifeq ($(FULL_TARGET),mips-linux)
+override TARGET_PROGRAMS+=mod_hello
+endif
+ifeq ($(FULL_TARGET),mipsel-linux)
+override TARGET_PROGRAMS+=mod_hello
+endif
+override INSTALL_FPCPACKAGE=y
+ifdef REQUIRE_UNITSDIR
+override UNITSDIR+=$(REQUIRE_UNITSDIR)
+endif
+ifdef REQUIRE_PACKAGESDIR
+override PACKAGESDIR+=$(REQUIRE_PACKAGESDIR)
+endif
+ifdef ZIPINSTALL
+ifneq ($(findstring $(OS_TARGET),$(UNIXs)),)
+UNIXHier=1
+endif
+else
+ifneq ($(findstring $(OS_SOURCE),$(UNIXs)),)
+UNIXHier=1
+endif
+endif
+ifndef INSTALL_PREFIX
+ifdef PREFIX
+INSTALL_PREFIX=$(PREFIX)
+endif
+endif
+ifndef INSTALL_PREFIX
+ifdef UNIXHier
+INSTALL_PREFIX=/usr/local
+else
+ifdef INSTALL_FPCPACKAGE
+INSTALL_BASEDIR:=/pp
+else
+INSTALL_BASEDIR:=/$(PACKAGE_NAME)
+endif
+endif
+endif
+export INSTALL_PREFIX
+ifdef INSTALL_FPCSUBDIR
+export INSTALL_FPCSUBDIR
+endif
+ifndef DIST_DESTDIR
+DIST_DESTDIR:=$(BASEDIR)
+endif
+export DIST_DESTDIR
+ifndef COMPILER_UNITTARGETDIR
+ifdef PACKAGEDIR_MAIN
+COMPILER_UNITTARGETDIR=$(PACKAGEDIR_MAIN)/units/$(TARGETSUFFIX)
+else
+COMPILER_UNITTARGETDIR=units/$(TARGETSUFFIX)
+endif
+endif
+ifndef COMPILER_TARGETDIR
+COMPILER_TARGETDIR=.
+endif
+ifndef INSTALL_BASEDIR
+ifdef UNIXHier
+ifdef INSTALL_FPCPACKAGE
+INSTALL_BASEDIR:=$(INSTALL_PREFIX)/lib/fpc/$(FPC_VERSION)
+else
+INSTALL_BASEDIR:=$(INSTALL_PREFIX)/lib/$(PACKAGE_NAME)
+endif
+else
+INSTALL_BASEDIR:=$(INSTALL_PREFIX)
+endif
+endif
+ifndef INSTALL_BINDIR
+ifdef UNIXHier
+INSTALL_BINDIR:=$(INSTALL_PREFIX)/bin
+else
+INSTALL_BINDIR:=$(INSTALL_BASEDIR)/bin
+ifdef INSTALL_FPCPACKAGE
+ifdef CROSSCOMPILE
+ifdef CROSSINSTALL
+INSTALL_BINDIR:=$(INSTALL_BINDIR)/$(SOURCESUFFIX)
+else
+INSTALL_BINDIR:=$(INSTALL_BINDIR)/$(TARGETSUFFIX)
+endif
+else
+INSTALL_BINDIR:=$(INSTALL_BINDIR)/$(TARGETSUFFIX)
+endif
+endif
+endif
+endif
+ifndef INSTALL_UNITDIR
+INSTALL_UNITDIR:=$(INSTALL_BASEDIR)/units/$(TARGETSUFFIX)
+ifdef INSTALL_FPCPACKAGE
+ifdef PACKAGE_NAME
+INSTALL_UNITDIR:=$(INSTALL_UNITDIR)/$(PACKAGE_NAME)
+endif
+endif
+endif
+ifndef INSTALL_LIBDIR
+ifdef UNIXHier
+INSTALL_LIBDIR:=$(INSTALL_PREFIX)/lib
+else
+INSTALL_LIBDIR:=$(INSTALL_UNITDIR)
+endif
+endif
+ifndef INSTALL_SOURCEDIR
+ifdef UNIXHier
+ifdef BSDhier
+SRCPREFIXDIR=share/src
+else
+ifdef linuxHier
+SRCPREFIXDIR=share/src
+else
+SRCPREFIXDIR=src
+endif
+endif
+ifdef INSTALL_FPCPACKAGE
+ifdef INSTALL_FPCSUBDIR
+INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/$(SRCPREFIXDIR)/fpc-$(FPC_VERSION)/$(INSTALL_FPCSUBDIR)/$(PACKAGE_NAME)
+else
+INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/$(SRCPREFIXDIR)/fpc-$(FPC_VERSION)/$(PACKAGE_NAME)
+endif
+else
+INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/$(SRCPREFIXDIR)/$(PACKAGE_NAME)-$(PACKAGE_VERSION)
+endif
+else
+ifdef INSTALL_FPCPACKAGE
+ifdef INSTALL_FPCSUBDIR
+INSTALL_SOURCEDIR:=$(INSTALL_BASEDIR)/source/$(INSTALL_FPCSUBDIR)/$(PACKAGE_NAME)
+else
+INSTALL_SOURCEDIR:=$(INSTALL_BASEDIR)/source/$(PACKAGE_NAME)
+endif
+else
+INSTALL_SOURCEDIR:=$(INSTALL_BASEDIR)/source
+endif
+endif
+endif
+ifndef INSTALL_DOCDIR
+ifdef UNIXHier
+ifdef BSDhier
+DOCPREFIXDIR=share/doc
+else
+ifdef linuxHier
+DOCPREFIXDIR=share/doc
+else
+DOCPREFIXDIR=doc
+endif
+endif
+ifdef INSTALL_FPCPACKAGE
+INSTALL_DOCDIR:=$(INSTALL_PREFIX)/$(DOCPREFIXDIR)/fpc-$(FPC_VERSION)/$(PACKAGE_NAME)
+else
+INSTALL_DOCDIR:=$(INSTALL_PREFIX)/$(DOCPREFIXDIR)/$(PACKAGE_NAME)-$(PACKAGE_VERSION)
+endif
+else
+ifdef INSTALL_FPCPACKAGE
+INSTALL_DOCDIR:=$(INSTALL_BASEDIR)/doc/$(PACKAGE_NAME)
+else
+INSTALL_DOCDIR:=$(INSTALL_BASEDIR)/doc
+endif
+endif
+endif
+ifndef INSTALL_EXAMPLEDIR
+ifdef UNIXHier
+ifdef INSTALL_FPCPACKAGE
+ifdef BSDhier
+INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/share/examples/fpc-$(FPC_VERSION)/$(PACKAGE_NAME)
+else
+ifdef linuxHier
+INSTALL_EXAMPLEDIR:=$(INSTALL_DOCDIR)/examples
+else
+INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/doc/fpc-$(FPC_VERSION)/examples/$(PACKAGE_NAME)
+endif
+endif
+else
+ifdef BSDhier
+INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/share/examples/$(PACKAGE_NAME)-$(PACKAGE_VERSION)
+else
+ifdef linuxHier
+INSTALL_EXAMPLEDIR:=$(INSTALL_DOCDIR)/examples/$(PACKAGE_NAME)-$(PACKAGE_VERSION)
+else
+INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/doc/$(PACKAGE_NAME)-$(PACKAGE_VERSION)
+endif
+endif
+endif
+else
+ifdef INSTALL_FPCPACKAGE
+INSTALL_EXAMPLEDIR:=$(INSTALL_BASEDIR)/examples/$(PACKAGE_NAME)
+else
+INSTALL_EXAMPLEDIR:=$(INSTALL_BASEDIR)/examples
+endif
+endif
+endif
+ifndef INSTALL_DATADIR
+INSTALL_DATADIR=$(INSTALL_BASEDIR)
+endif
+ifndef INSTALL_SHAREDDIR
+INSTALL_SHAREDDIR=$(INSTALL_PREFIX)/lib
+endif
+ifdef CROSSCOMPILE
+ifndef CROSSBINDIR
+CROSSBINDIR:=$(wildcard $(CROSSTARGETDIR)/bin/$(SOURCESUFFIX))
+ifeq ($(CROSSBINDIR),)
+CROSSBINDIR:=$(wildcard $(INSTALL_BASEDIR)/cross/$(TARGETSUFFIX)/bin/$(FULL_SOURCE))
+endif
+endif
+else
+CROSSBINDIR=
+endif
+BATCHEXT=.bat
+LOADEREXT=.as
+EXEEXT=.exe
+PPLEXT=.ppl
+PPUEXT=.ppu
+OEXT=.o
+ASMEXT=.s
+SMARTEXT=.sl
+STATICLIBEXT=.a
+SHAREDLIBEXT=.so
+SHAREDLIBPREFIX=libfp
+STATICLIBPREFIX=libp
+IMPORTLIBPREFIX=libimp
+RSTEXT=.rst
+EXEDBGEXT=.dbg
+ifeq ($(OS_TARGET),go32v1)
+STATICLIBPREFIX=
+SHORTSUFFIX=v1
+endif
+ifeq ($(OS_TARGET),go32v2)
+STATICLIBPREFIX=
+SHORTSUFFIX=dos
+IMPORTLIBPREFIX=
+endif
+ifeq ($(OS_TARGET),watcom)
+STATICLIBPREFIX=
+OEXT=.obj
+ASMEXT=.asm
+SHAREDLIBEXT=.dll
+SHORTSUFFIX=wat
+IMPORTLIBPREFIX=
+endif
+ifeq ($(OS_TARGET),linux)
+BATCHEXT=.sh
+EXEEXT=
+HASSHAREDLIB=1
+SHORTSUFFIX=lnx
+endif
+ifeq ($(OS_TARGET),freebsd)
+BATCHEXT=.sh
+EXEEXT=
+HASSHAREDLIB=1
+SHORTSUFFIX=fbs
+endif
+ifeq ($(OS_TARGET),netbsd)
+BATCHEXT=.sh
+EXEEXT=
+HASSHAREDLIB=1
+SHORTSUFFIX=nbs
+endif
+ifeq ($(OS_TARGET),openbsd)
+BATCHEXT=.sh
+EXEEXT=
+HASSHAREDLIB=1
+SHORTSUFFIX=obs
+endif
+ifeq ($(OS_TARGET),win32)
+SHAREDLIBEXT=.dll
+SHORTSUFFIX=w32
+endif
+ifeq ($(OS_TARGET),os2)
+BATCHEXT=.cmd
+AOUTEXT=.out
+STATICLIBPREFIX=
+SHAREDLIBEXT=.dll
+SHORTSUFFIX=os2
+ECHO=echo
+IMPORTLIBPREFIX=
+endif
+ifeq ($(OS_TARGET),emx)
+BATCHEXT=.cmd
+AOUTEXT=.out
+STATICLIBPREFIX=
+SHAREDLIBEXT=.dll
+SHORTSUFFIX=emx
+ECHO=echo
+IMPORTLIBPREFIX=
+endif
+ifeq ($(OS_TARGET),amiga)
+EXEEXT=
+SHAREDLIBEXT=.library
+SHORTSUFFIX=amg
+endif
+ifeq ($(OS_TARGET),morphos)
+EXEEXT=
+SHAREDLIBEXT=.library
+SHORTSUFFIX=mos
+endif
+ifeq ($(OS_TARGET),atari)
+EXEEXT=.ttp
+SHORTSUFFIX=ata
+endif
+ifeq ($(OS_TARGET),beos)
+BATCHEXT=.sh
+EXEEXT=
+SHORTSUFFIX=be
+endif
+ifeq ($(OS_TARGET),haiku)
+BATCHEXT=.sh
+EXEEXT=
+SHORTSUFFIX=hai
+endif
+ifeq ($(OS_TARGET),solaris)
+BATCHEXT=.sh
+EXEEXT=
+SHORTSUFFIX=sun
+endif
+ifeq ($(OS_TARGET),qnx)
+BATCHEXT=.sh
+EXEEXT=
+SHORTSUFFIX=qnx
+endif
+ifeq ($(OS_TARGET),netware)
+EXEEXT=.nlm
+STATICLIBPREFIX=
+SHORTSUFFIX=nw
+IMPORTLIBPREFIX=imp
+endif
+ifeq ($(OS_TARGET),netwlibc)
+EXEEXT=.nlm
+STATICLIBPREFIX=
+SHORTSUFFIX=nwl
+IMPORTLIBPREFIX=imp
+endif
+ifeq ($(OS_TARGET),macos)
+BATCHEXT=
+EXEEXT=
+DEBUGSYMEXT=.xcoff
+SHORTSUFFIX=mac
+IMPORTLIBPREFIX=imp
+endif
+ifneq ($(findstring $(OS_TARGET),darwin iphonesim),)
+BATCHEXT=.sh
+EXEEXT=
+HASSHAREDLIB=1
+SHORTSUFFIX=dwn
+EXEDBGEXT=.dSYM
+endif
+ifeq ($(OS_TARGET),gba)
+EXEEXT=.gba
+SHAREDLIBEXT=.so
+SHORTSUFFIX=gba
+endif
+ifeq ($(OS_TARGET),symbian)
+SHAREDLIBEXT=.dll
+SHORTSUFFIX=symbian
+endif
+ifeq ($(OS_TARGET),NativeNT)
+SHAREDLIBEXT=.dll
+SHORTSUFFIX=nativent
+endif
+ifeq ($(OS_TARGET),wii)
+EXEEXT=.dol
+SHAREDLIBEXT=.so
+SHORTSUFFIX=wii
+endif
+ifeq ($(OS_TARGET),aix)
+BATCHEXT=.sh
+EXEEXT=
+SHORTSUFFIX=aix
+endif
+ifneq ($(findstring $(OS_SOURCE),$(LIMIT83fs)),)
+FPCMADE=fpcmade.$(SHORTSUFFIX)
+ZIPSUFFIX=$(SHORTSUFFIX)
+ZIPCROSSPREFIX=
+ZIPSOURCESUFFIX=src
+ZIPEXAMPLESUFFIX=exm
+else
+FPCMADE=fpcmade.$(TARGETSUFFIX)
+ZIPSOURCESUFFIX=.source
+ZIPEXAMPLESUFFIX=.examples
+ifdef CROSSCOMPILE
+ZIPSUFFIX=.$(SOURCESUFFIX)
+ZIPCROSSPREFIX=$(TARGETSUFFIX)-
+else
+ZIPSUFFIX=.$(TARGETSUFFIX)
+ZIPCROSSPREFIX=
+endif
+endif
+ifndef ECHO
+ECHO:=$(strip $(wildcard $(addsuffix /gecho$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(ECHO),)
+ECHO:=$(strip $(wildcard $(addsuffix /echo$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(ECHO),)
+ECHO= __missing_command_ECHO
+else
+ECHO:=$(firstword $(ECHO))
+endif
+else
+ECHO:=$(firstword $(ECHO))
+endif
+endif
+export ECHO
+ifndef DATE
+DATE:=$(strip $(wildcard $(addsuffix /gdate$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(DATE),)
+DATE:=$(strip $(wildcard $(addsuffix /date$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(DATE),)
+DATE= __missing_command_DATE
+else
+DATE:=$(firstword $(DATE))
+endif
+else
+DATE:=$(firstword $(DATE))
+endif
+endif
+export DATE
+ifndef GINSTALL
+GINSTALL:=$(strip $(wildcard $(addsuffix /ginstall$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(GINSTALL),)
+GINSTALL:=$(strip $(wildcard $(addsuffix /install$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(GINSTALL),)
+GINSTALL= __missing_command_GINSTALL
+else
+GINSTALL:=$(firstword $(GINSTALL))
+endif
+else
+GINSTALL:=$(firstword $(GINSTALL))
+endif
+endif
+export GINSTALL
+ifndef CPPROG
+CPPROG:=$(strip $(wildcard $(addsuffix /cp$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(CPPROG),)
+CPPROG= __missing_command_CPPROG
+else
+CPPROG:=$(firstword $(CPPROG))
+endif
+endif
+export CPPROG
+ifndef RMPROG
+RMPROG:=$(strip $(wildcard $(addsuffix /rm$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(RMPROG),)
+RMPROG= __missing_command_RMPROG
+else
+RMPROG:=$(firstword $(RMPROG))
+endif
+endif
+export RMPROG
+ifndef MVPROG
+MVPROG:=$(strip $(wildcard $(addsuffix /mv$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(MVPROG),)
+MVPROG= __missing_command_MVPROG
+else
+MVPROG:=$(firstword $(MVPROG))
+endif
+endif
+export MVPROG
+ifndef MKDIRPROG
+MKDIRPROG:=$(strip $(wildcard $(addsuffix /gmkdir$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(MKDIRPROG),)
+MKDIRPROG:=$(strip $(wildcard $(addsuffix /mkdir$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(MKDIRPROG),)
+MKDIRPROG= __missing_command_MKDIRPROG
+else
+MKDIRPROG:=$(firstword $(MKDIRPROG))
+endif
+else
+MKDIRPROG:=$(firstword $(MKDIRPROG))
+endif
+endif
+export MKDIRPROG
+ifndef ECHOREDIR
+ifndef inUnix
+ECHOREDIR=echo
+else
+ECHOREDIR=$(ECHO)
+endif
+endif
+ifndef COPY
+COPY:=$(CPPROG) -fp
+endif
+ifndef COPYTREE
+COPYTREE:=$(CPPROG) -Rfp
+endif
+ifndef MKDIRTREE
+MKDIRTREE:=$(MKDIRPROG) -p
+endif
+ifndef MOVE
+MOVE:=$(MVPROG) -f
+endif
+ifndef DEL
+DEL:=$(RMPROG) -f
+endif
+ifndef DELTREE
+DELTREE:=$(RMPROG) -rf
+endif
+ifndef INSTALL
+ifdef inUnix
+INSTALL:=$(GINSTALL) -c -m 644
+else
+INSTALL:=$(COPY)
+endif
+endif
+ifndef INSTALLEXE
+ifdef inUnix
+INSTALLEXE:=$(GINSTALL) -c -m 755
+else
+INSTALLEXE:=$(COPY)
+endif
+endif
+ifndef MKDIR
+MKDIR:=$(GINSTALL) -m 755 -d
+endif
+export ECHOREDIR COPY COPYTREE MOVE DEL DELTREE INSTALL INSTALLEXE MKDIR
+ifndef PPUMOVE
+PPUMOVE:=$(strip $(wildcard $(addsuffix /ppumove$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(PPUMOVE),)
+PPUMOVE= __missing_command_PPUMOVE
+else
+PPUMOVE:=$(firstword $(PPUMOVE))
+endif
+endif
+export PPUMOVE
+ifndef FPCMAKE
+FPCMAKE:=$(strip $(wildcard $(addsuffix /fpcmake$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(FPCMAKE),)
+FPCMAKE= __missing_command_FPCMAKE
+else
+FPCMAKE:=$(firstword $(FPCMAKE))
+endif
+endif
+export FPCMAKE
+ifndef ZIPPROG
+ZIPPROG:=$(strip $(wildcard $(addsuffix /zip$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(ZIPPROG),)
+ZIPPROG= __missing_command_ZIPPROG
+else
+ZIPPROG:=$(firstword $(ZIPPROG))
+endif
+endif
+export ZIPPROG
+ifndef TARPROG
+TARPROG:=$(strip $(wildcard $(addsuffix /gtar$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(TARPROG),)
+TARPROG:=$(strip $(wildcard $(addsuffix /tar$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(TARPROG),)
+TARPROG= __missing_command_TARPROG
+else
+TARPROG:=$(firstword $(TARPROG))
+endif
+else
+TARPROG:=$(firstword $(TARPROG))
+endif
+endif
+export TARPROG
+ASNAME=$(BINUTILSPREFIX)as
+LDNAME=$(BINUTILSPREFIX)ld
+ARNAME=$(BINUTILSPREFIX)ar
+RCNAME=$(BINUTILSPREFIX)rc
+ifndef ASPROG
+ifdef CROSSBINDIR
+ASPROG=$(CROSSBINDIR)/$(ASNAME)$(SRCEXEEXT)
+else
+ASPROG=$(ASNAME)
+endif
+endif
+ifndef LDPROG
+ifdef CROSSBINDIR
+LDPROG=$(CROSSBINDIR)/$(LDNAME)$(SRCEXEEXT)
+else
+LDPROG=$(LDNAME)
+endif
+endif
+ifndef RCPROG
+ifdef CROSSBINDIR
+RCPROG=$(CROSSBINDIR)/$(RCNAME)$(SRCEXEEXT)
+else
+RCPROG=$(RCNAME)
+endif
+endif
+ifndef ARPROG
+ifdef CROSSBINDIR
+ARPROG=$(CROSSBINDIR)/$(ARNAME)$(SRCEXEEXT)
+else
+ARPROG=$(ARNAME)
+endif
+endif
+AS=$(ASPROG)
+LD=$(LDPROG)
+RC=$(RCPROG)
+AR=$(ARPROG)
+PPAS=ppas$(SRCBATCHEXT)
+ifdef inUnix
+LDCONFIG=ldconfig
+else
+LDCONFIG=
+endif
+ifdef DATE
+DATESTR:=$(shell $(DATE) +%Y%m%d)
+else
+DATESTR=
+endif
+ZIPOPT=-9
+ZIPEXT=.zip
+ifeq ($(USETAR),bz2)
+TAROPT=vj
+TAREXT=.tar.bz2
+else
+TAROPT=vz
+TAREXT=.tar.gz
+endif
+override REQUIRE_PACKAGES=rtl httpd24
+ifeq ($(FULL_TARGET),i386-linux)
+REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_PASZLIB=1
+REQUIRE_PACKAGES_FCL-PROCESS=1
+REQUIRE_PACKAGES_HASH=1
+REQUIRE_PACKAGES_FPMKUNIT=1
+REQUIRE_PACKAGES_HTTPD24=1
+endif
+ifeq ($(FULL_TARGET),i386-go32v2)
+REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_PASZLIB=1
+REQUIRE_PACKAGES_FCL-PROCESS=1
+REQUIRE_PACKAGES_HASH=1
+REQUIRE_PACKAGES_FPMKUNIT=1
+REQUIRE_PACKAGES_HTTPD24=1
+endif
+ifeq ($(FULL_TARGET),i386-win32)
+REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_PASZLIB=1
+REQUIRE_PACKAGES_FCL-PROCESS=1
+REQUIRE_PACKAGES_HASH=1
+REQUIRE_PACKAGES_FPMKUNIT=1
+REQUIRE_PACKAGES_HTTPD24=1
+endif
+ifeq ($(FULL_TARGET),i386-os2)
+REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_PASZLIB=1
+REQUIRE_PACKAGES_FCL-PROCESS=1
+REQUIRE_PACKAGES_HASH=1
+REQUIRE_PACKAGES_FPMKUNIT=1
+REQUIRE_PACKAGES_HTTPD24=1
+endif
+ifeq ($(FULL_TARGET),i386-freebsd)
+REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_PASZLIB=1
+REQUIRE_PACKAGES_FCL-PROCESS=1
+REQUIRE_PACKAGES_HASH=1
+REQUIRE_PACKAGES_FPMKUNIT=1
+REQUIRE_PACKAGES_HTTPD24=1
+endif
+ifeq ($(FULL_TARGET),i386-beos)
+REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_PASZLIB=1
+REQUIRE_PACKAGES_FCL-PROCESS=1
+REQUIRE_PACKAGES_HASH=1
+REQUIRE_PACKAGES_FPMKUNIT=1
+REQUIRE_PACKAGES_HTTPD24=1
+endif
+ifeq ($(FULL_TARGET),i386-haiku)
+REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_PASZLIB=1
+REQUIRE_PACKAGES_FCL-PROCESS=1
+REQUIRE_PACKAGES_HASH=1
+REQUIRE_PACKAGES_FPMKUNIT=1
+REQUIRE_PACKAGES_HTTPD24=1
+endif
+ifeq ($(FULL_TARGET),i386-netbsd)
+REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_PASZLIB=1
+REQUIRE_PACKAGES_FCL-PROCESS=1
+REQUIRE_PACKAGES_HASH=1
+REQUIRE_PACKAGES_FPMKUNIT=1
+REQUIRE_PACKAGES_HTTPD24=1
+endif
+ifeq ($(FULL_TARGET),i386-solaris)
+REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_PASZLIB=1
+REQUIRE_PACKAGES_FCL-PROCESS=1
+REQUIRE_PACKAGES_HASH=1
+REQUIRE_PACKAGES_FPMKUNIT=1
+REQUIRE_PACKAGES_HTTPD24=1
+endif
+ifeq ($(FULL_TARGET),i386-qnx)
+REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_PASZLIB=1
+REQUIRE_PACKAGES_FCL-PROCESS=1
+REQUIRE_PACKAGES_HASH=1
+REQUIRE_PACKAGES_FPMKUNIT=1
+REQUIRE_PACKAGES_HTTPD24=1
+endif
+ifeq ($(FULL_TARGET),i386-netware)
+REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_PASZLIB=1
+REQUIRE_PACKAGES_FCL-PROCESS=1
+REQUIRE_PACKAGES_HASH=1
+REQUIRE_PACKAGES_FPMKUNIT=1
+REQUIRE_PACKAGES_HTTPD24=1
+endif
+ifeq ($(FULL_TARGET),i386-openbsd)
+REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_PASZLIB=1
+REQUIRE_PACKAGES_FCL-PROCESS=1
+REQUIRE_PACKAGES_HASH=1
+REQUIRE_PACKAGES_FPMKUNIT=1
+REQUIRE_PACKAGES_HTTPD24=1
+endif
+ifeq ($(FULL_TARGET),i386-wdosx)
+REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_PASZLIB=1
+REQUIRE_PACKAGES_FCL-PROCESS=1
+REQUIRE_PACKAGES_HASH=1
+REQUIRE_PACKAGES_FPMKUNIT=1
+REQUIRE_PACKAGES_HTTPD24=1
+endif
+ifeq ($(FULL_TARGET),i386-darwin)
+REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_PASZLIB=1
+REQUIRE_PACKAGES_FCL-PROCESS=1
+REQUIRE_PACKAGES_HASH=1
+REQUIRE_PACKAGES_FPMKUNIT=1
+REQUIRE_PACKAGES_HTTPD24=1
+endif
+ifeq ($(FULL_TARGET),i386-emx)
+REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_PASZLIB=1
+REQUIRE_PACKAGES_FCL-PROCESS=1
+REQUIRE_PACKAGES_HASH=1
+REQUIRE_PACKAGES_FPMKUNIT=1
+REQUIRE_PACKAGES_HTTPD24=1
+endif
+ifeq ($(FULL_TARGET),i386-watcom)
+REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_PASZLIB=1
+REQUIRE_PACKAGES_FCL-PROCESS=1
+REQUIRE_PACKAGES_HASH=1
+REQUIRE_PACKAGES_FPMKUNIT=1
+REQUIRE_PACKAGES_HTTPD24=1
+endif
+ifeq ($(FULL_TARGET),i386-netwlibc)
+REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_PASZLIB=1
+REQUIRE_PACKAGES_FCL-PROCESS=1
+REQUIRE_PACKAGES_HASH=1
+REQUIRE_PACKAGES_FPMKUNIT=1
+REQUIRE_PACKAGES_HTTPD24=1
+endif
+ifeq ($(FULL_TARGET),i386-wince)
+REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_PASZLIB=1
+REQUIRE_PACKAGES_FCL-PROCESS=1
+REQUIRE_PACKAGES_HASH=1
+REQUIRE_PACKAGES_FPMKUNIT=1
+REQUIRE_PACKAGES_HTTPD24=1
+endif
+ifeq ($(FULL_TARGET),i386-embedded)
+REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_PASZLIB=1
+REQUIRE_PACKAGES_FCL-PROCESS=1
+REQUIRE_PACKAGES_HASH=1
+REQUIRE_PACKAGES_FPMKUNIT=1
+REQUIRE_PACKAGES_HTTPD24=1
+endif
+ifeq ($(FULL_TARGET),i386-symbian)
+REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_PASZLIB=1
+REQUIRE_PACKAGES_FCL-PROCESS=1
+REQUIRE_PACKAGES_HASH=1
+REQUIRE_PACKAGES_FPMKUNIT=1
+REQUIRE_PACKAGES_HTTPD24=1
+endif
+ifeq ($(FULL_TARGET),i386-nativent)
+REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_PASZLIB=1
+REQUIRE_PACKAGES_FCL-PROCESS=1
+REQUIRE_PACKAGES_HASH=1
+REQUIRE_PACKAGES_FPMKUNIT=1
+REQUIRE_PACKAGES_HTTPD24=1
+endif
+ifeq ($(FULL_TARGET),i386-iphonesim)
+REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_PASZLIB=1
+REQUIRE_PACKAGES_FCL-PROCESS=1
+REQUIRE_PACKAGES_HASH=1
+REQUIRE_PACKAGES_FPMKUNIT=1
+REQUIRE_PACKAGES_HTTPD24=1
+endif
+ifeq ($(FULL_TARGET),m68k-linux)
+REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_PASZLIB=1
+REQUIRE_PACKAGES_FCL-PROCESS=1
+REQUIRE_PACKAGES_HASH=1
+REQUIRE_PACKAGES_FPMKUNIT=1
+REQUIRE_PACKAGES_HTTPD24=1
+endif
+ifeq ($(FULL_TARGET),m68k-freebsd)
+REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_PASZLIB=1
+REQUIRE_PACKAGES_FCL-PROCESS=1
+REQUIRE_PACKAGES_HASH=1
+REQUIRE_PACKAGES_FPMKUNIT=1
+REQUIRE_PACKAGES_HTTPD24=1
+endif
+ifeq ($(FULL_TARGET),m68k-netbsd)
+REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_PASZLIB=1
+REQUIRE_PACKAGES_FCL-PROCESS=1
+REQUIRE_PACKAGES_HASH=1
+REQUIRE_PACKAGES_FPMKUNIT=1
+REQUIRE_PACKAGES_HTTPD24=1
+endif
+ifeq ($(FULL_TARGET),m68k-amiga)
+REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_PASZLIB=1
+REQUIRE_PACKAGES_FCL-PROCESS=1
+REQUIRE_PACKAGES_HASH=1
+REQUIRE_PACKAGES_FPMKUNIT=1
+REQUIRE_PACKAGES_HTTPD24=1
+endif
+ifeq ($(FULL_TARGET),m68k-atari)
+REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_PASZLIB=1
+REQUIRE_PACKAGES_FCL-PROCESS=1
+REQUIRE_PACKAGES_HASH=1
+REQUIRE_PACKAGES_FPMKUNIT=1
+REQUIRE_PACKAGES_HTTPD24=1
+endif
+ifeq ($(FULL_TARGET),m68k-openbsd)
+REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_PASZLIB=1
+REQUIRE_PACKAGES_FCL-PROCESS=1
+REQUIRE_PACKAGES_HASH=1
+REQUIRE_PACKAGES_FPMKUNIT=1
+REQUIRE_PACKAGES_HTTPD24=1
+endif
+ifeq ($(FULL_TARGET),m68k-palmos)
+REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_PASZLIB=1
+REQUIRE_PACKAGES_FCL-PROCESS=1
+REQUIRE_PACKAGES_HASH=1
+REQUIRE_PACKAGES_FPMKUNIT=1
+REQUIRE_PACKAGES_HTTPD24=1
+endif
+ifeq ($(FULL_TARGET),m68k-embedded)
+REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_PASZLIB=1
+REQUIRE_PACKAGES_FCL-PROCESS=1
+REQUIRE_PACKAGES_HASH=1
+REQUIRE_PACKAGES_FPMKUNIT=1
+REQUIRE_PACKAGES_HTTPD24=1
+endif
+ifeq ($(FULL_TARGET),powerpc-linux)
+REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_PASZLIB=1
+REQUIRE_PACKAGES_FCL-PROCESS=1
+REQUIRE_PACKAGES_HASH=1
+REQUIRE_PACKAGES_FPMKUNIT=1
+REQUIRE_PACKAGES_HTTPD24=1
+endif
+ifeq ($(FULL_TARGET),powerpc-netbsd)
+REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_PASZLIB=1
+REQUIRE_PACKAGES_FCL-PROCESS=1
+REQUIRE_PACKAGES_HASH=1
+REQUIRE_PACKAGES_FPMKUNIT=1
+REQUIRE_PACKAGES_HTTPD24=1
+endif
+ifeq ($(FULL_TARGET),powerpc-amiga)
+REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_PASZLIB=1
+REQUIRE_PACKAGES_FCL-PROCESS=1
+REQUIRE_PACKAGES_HASH=1
+REQUIRE_PACKAGES_FPMKUNIT=1
+REQUIRE_PACKAGES_HTTPD24=1
+endif
+ifeq ($(FULL_TARGET),powerpc-macos)
+REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_PASZLIB=1
+REQUIRE_PACKAGES_FCL-PROCESS=1
+REQUIRE_PACKAGES_HASH=1
+REQUIRE_PACKAGES_FPMKUNIT=1
+REQUIRE_PACKAGES_HTTPD24=1
+endif
+ifeq ($(FULL_TARGET),powerpc-darwin)
+REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_PASZLIB=1
+REQUIRE_PACKAGES_FCL-PROCESS=1
+REQUIRE_PACKAGES_HASH=1
+REQUIRE_PACKAGES_FPMKUNIT=1
+REQUIRE_PACKAGES_HTTPD24=1
+endif
+ifeq ($(FULL_TARGET),powerpc-morphos)
+REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_PASZLIB=1
+REQUIRE_PACKAGES_FCL-PROCESS=1
+REQUIRE_PACKAGES_HASH=1
+REQUIRE_PACKAGES_FPMKUNIT=1
+REQUIRE_PACKAGES_HTTPD24=1
+endif
+ifeq ($(FULL_TARGET),powerpc-embedded)
+REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_PASZLIB=1
+REQUIRE_PACKAGES_FCL-PROCESS=1
+REQUIRE_PACKAGES_HASH=1
+REQUIRE_PACKAGES_FPMKUNIT=1
+REQUIRE_PACKAGES_HTTPD24=1
+endif
+ifeq ($(FULL_TARGET),powerpc-wii)
+REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_PASZLIB=1
+REQUIRE_PACKAGES_FCL-PROCESS=1
+REQUIRE_PACKAGES_HASH=1
+REQUIRE_PACKAGES_FPMKUNIT=1
+REQUIRE_PACKAGES_HTTPD24=1
+endif
+ifeq ($(FULL_TARGET),powerpc-aix)
+REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_PASZLIB=1
+REQUIRE_PACKAGES_FCL-PROCESS=1
+REQUIRE_PACKAGES_HASH=1
+REQUIRE_PACKAGES_FPMKUNIT=1
+REQUIRE_PACKAGES_HTTPD24=1
+endif
+ifeq ($(FULL_TARGET),sparc-linux)
+REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_PASZLIB=1
+REQUIRE_PACKAGES_FCL-PROCESS=1
+REQUIRE_PACKAGES_HASH=1
+REQUIRE_PACKAGES_FPMKUNIT=1
+REQUIRE_PACKAGES_HTTPD24=1
+endif
+ifeq ($(FULL_TARGET),sparc-netbsd)
+REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_PASZLIB=1
+REQUIRE_PACKAGES_FCL-PROCESS=1
+REQUIRE_PACKAGES_HASH=1
+REQUIRE_PACKAGES_FPMKUNIT=1
+REQUIRE_PACKAGES_HTTPD24=1
+endif
+ifeq ($(FULL_TARGET),sparc-solaris)
+REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_PASZLIB=1
+REQUIRE_PACKAGES_FCL-PROCESS=1
+REQUIRE_PACKAGES_HASH=1
+REQUIRE_PACKAGES_FPMKUNIT=1
+REQUIRE_PACKAGES_HTTPD24=1
+endif
+ifeq ($(FULL_TARGET),sparc-embedded)
+REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_PASZLIB=1
+REQUIRE_PACKAGES_FCL-PROCESS=1
+REQUIRE_PACKAGES_HASH=1
+REQUIRE_PACKAGES_FPMKUNIT=1
+REQUIRE_PACKAGES_HTTPD24=1
+endif
+ifeq ($(FULL_TARGET),x86_64-linux)
+REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_PASZLIB=1
+REQUIRE_PACKAGES_FCL-PROCESS=1
+REQUIRE_PACKAGES_HASH=1
+REQUIRE_PACKAGES_FPMKUNIT=1
+REQUIRE_PACKAGES_HTTPD24=1
+endif
+ifeq ($(FULL_TARGET),x86_64-freebsd)
+REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_PASZLIB=1
+REQUIRE_PACKAGES_FCL-PROCESS=1
+REQUIRE_PACKAGES_HASH=1
+REQUIRE_PACKAGES_FPMKUNIT=1
+REQUIRE_PACKAGES_HTTPD24=1
+endif
+ifeq ($(FULL_TARGET),x86_64-netbsd)
+REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_PASZLIB=1
+REQUIRE_PACKAGES_FCL-PROCESS=1
+REQUIRE_PACKAGES_HASH=1
+REQUIRE_PACKAGES_FPMKUNIT=1
+REQUIRE_PACKAGES_HTTPD24=1
+endif
+ifeq ($(FULL_TARGET),x86_64-solaris)
+REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_PASZLIB=1
+REQUIRE_PACKAGES_FCL-PROCESS=1
+REQUIRE_PACKAGES_HASH=1
+REQUIRE_PACKAGES_FPMKUNIT=1
+REQUIRE_PACKAGES_HTTPD24=1
+endif
+ifeq ($(FULL_TARGET),x86_64-openbsd)
+REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_PASZLIB=1
+REQUIRE_PACKAGES_FCL-PROCESS=1
+REQUIRE_PACKAGES_HASH=1
+REQUIRE_PACKAGES_FPMKUNIT=1
+REQUIRE_PACKAGES_HTTPD24=1
+endif
+ifeq ($(FULL_TARGET),x86_64-darwin)
+REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_PASZLIB=1
+REQUIRE_PACKAGES_FCL-PROCESS=1
+REQUIRE_PACKAGES_HASH=1
+REQUIRE_PACKAGES_FPMKUNIT=1
+REQUIRE_PACKAGES_HTTPD24=1
+endif
+ifeq ($(FULL_TARGET),x86_64-win64)
+REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_PASZLIB=1
+REQUIRE_PACKAGES_FCL-PROCESS=1
+REQUIRE_PACKAGES_HASH=1
+REQUIRE_PACKAGES_FPMKUNIT=1
+REQUIRE_PACKAGES_HTTPD24=1
+endif
+ifeq ($(FULL_TARGET),x86_64-embedded)
+REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_PASZLIB=1
+REQUIRE_PACKAGES_FCL-PROCESS=1
+REQUIRE_PACKAGES_HASH=1
+REQUIRE_PACKAGES_FPMKUNIT=1
+REQUIRE_PACKAGES_HTTPD24=1
+endif
+ifeq ($(FULL_TARGET),arm-linux)
+REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_PASZLIB=1
+REQUIRE_PACKAGES_FCL-PROCESS=1
+REQUIRE_PACKAGES_HASH=1
+REQUIRE_PACKAGES_FPMKUNIT=1
+REQUIRE_PACKAGES_HTTPD24=1
+endif
+ifeq ($(FULL_TARGET),arm-palmos)
+REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_PASZLIB=1
+REQUIRE_PACKAGES_FCL-PROCESS=1
+REQUIRE_PACKAGES_HASH=1
+REQUIRE_PACKAGES_FPMKUNIT=1
+REQUIRE_PACKAGES_HTTPD24=1
+endif
+ifeq ($(FULL_TARGET),arm-darwin)
+REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_PASZLIB=1
+REQUIRE_PACKAGES_FCL-PROCESS=1
+REQUIRE_PACKAGES_HASH=1
+REQUIRE_PACKAGES_FPMKUNIT=1
+REQUIRE_PACKAGES_HTTPD24=1
+endif
+ifeq ($(FULL_TARGET),arm-wince)
+REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_PASZLIB=1
+REQUIRE_PACKAGES_FCL-PROCESS=1
+REQUIRE_PACKAGES_HASH=1
+REQUIRE_PACKAGES_FPMKUNIT=1
+REQUIRE_PACKAGES_HTTPD24=1
+endif
+ifeq ($(FULL_TARGET),arm-gba)
+REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_PASZLIB=1
+REQUIRE_PACKAGES_FCL-PROCESS=1
+REQUIRE_PACKAGES_HASH=1
+REQUIRE_PACKAGES_FPMKUNIT=1
+REQUIRE_PACKAGES_HTTPD24=1
+endif
+ifeq ($(FULL_TARGET),arm-nds)
+REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_PASZLIB=1
+REQUIRE_PACKAGES_FCL-PROCESS=1
+REQUIRE_PACKAGES_HASH=1
+REQUIRE_PACKAGES_FPMKUNIT=1
+REQUIRE_PACKAGES_HTTPD24=1
+endif
+ifeq ($(FULL_TARGET),arm-embedded)
+REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_PASZLIB=1
+REQUIRE_PACKAGES_FCL-PROCESS=1
+REQUIRE_PACKAGES_HASH=1
+REQUIRE_PACKAGES_FPMKUNIT=1
+REQUIRE_PACKAGES_HTTPD24=1
+endif
+ifeq ($(FULL_TARGET),arm-symbian)
+REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_PASZLIB=1
+REQUIRE_PACKAGES_FCL-PROCESS=1
+REQUIRE_PACKAGES_HASH=1
+REQUIRE_PACKAGES_FPMKUNIT=1
+REQUIRE_PACKAGES_HTTPD24=1
+endif
+ifeq ($(FULL_TARGET),powerpc64-linux)
+REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_PASZLIB=1
+REQUIRE_PACKAGES_FCL-PROCESS=1
+REQUIRE_PACKAGES_HASH=1
+REQUIRE_PACKAGES_FPMKUNIT=1
+REQUIRE_PACKAGES_HTTPD24=1
+endif
+ifeq ($(FULL_TARGET),powerpc64-darwin)
+REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_PASZLIB=1
+REQUIRE_PACKAGES_FCL-PROCESS=1
+REQUIRE_PACKAGES_HASH=1
+REQUIRE_PACKAGES_FPMKUNIT=1
+REQUIRE_PACKAGES_HTTPD24=1
+endif
+ifeq ($(FULL_TARGET),powerpc64-embedded)
+REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_PASZLIB=1
+REQUIRE_PACKAGES_FCL-PROCESS=1
+REQUIRE_PACKAGES_HASH=1
+REQUIRE_PACKAGES_FPMKUNIT=1
+REQUIRE_PACKAGES_HTTPD24=1
+endif
+ifeq ($(FULL_TARGET),powerpc64-aix)
+REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_PASZLIB=1
+REQUIRE_PACKAGES_FCL-PROCESS=1
+REQUIRE_PACKAGES_HASH=1
+REQUIRE_PACKAGES_FPMKUNIT=1
+REQUIRE_PACKAGES_HTTPD24=1
+endif
+ifeq ($(FULL_TARGET),avr-embedded)
+REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_PASZLIB=1
+REQUIRE_PACKAGES_FCL-PROCESS=1
+REQUIRE_PACKAGES_HASH=1
+REQUIRE_PACKAGES_FPMKUNIT=1
+REQUIRE_PACKAGES_HTTPD24=1
+endif
+ifeq ($(FULL_TARGET),armeb-linux)
+REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_PASZLIB=1
+REQUIRE_PACKAGES_FCL-PROCESS=1
+REQUIRE_PACKAGES_HASH=1
+REQUIRE_PACKAGES_FPMKUNIT=1
+REQUIRE_PACKAGES_HTTPD24=1
+endif
+ifeq ($(FULL_TARGET),armeb-embedded)
+REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_PASZLIB=1
+REQUIRE_PACKAGES_FCL-PROCESS=1
+REQUIRE_PACKAGES_HASH=1
+REQUIRE_PACKAGES_FPMKUNIT=1
+REQUIRE_PACKAGES_HTTPD24=1
+endif
+ifeq ($(FULL_TARGET),mips-linux)
+REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_PASZLIB=1
+REQUIRE_PACKAGES_FCL-PROCESS=1
+REQUIRE_PACKAGES_HASH=1
+REQUIRE_PACKAGES_FPMKUNIT=1
+REQUIRE_PACKAGES_HTTPD24=1
+endif
+ifeq ($(FULL_TARGET),mipsel-linux)
+REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_PASZLIB=1
+REQUIRE_PACKAGES_FCL-PROCESS=1
+REQUIRE_PACKAGES_HASH=1
+REQUIRE_PACKAGES_FPMKUNIT=1
+REQUIRE_PACKAGES_HTTPD24=1
+endif
+ifdef REQUIRE_PACKAGES_RTL
+PACKAGEDIR_RTL:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /rtl/Makefile.fpc,$(PACKAGESDIR))))))
+ifneq ($(PACKAGEDIR_RTL),)
+ifneq ($(wildcard $(PACKAGEDIR_RTL)/units/$(TARGETSUFFIX)),)
+UNITDIR_RTL=$(PACKAGEDIR_RTL)/units/$(TARGETSUFFIX)
+else
+UNITDIR_RTL=$(PACKAGEDIR_RTL)
+endif
+ifneq ($(wildcard $(PACKAGEDIR_RTL)/units/$(SOURCESUFFIX)),)
+UNITDIR_FPMAKE_RTL=$(PACKAGEDIR_RTL)/units/$(SOURCESUFFIX)
+else
+ifneq ($(wildcard $(PACKAGEDIR_RTL)/units_bs/$(SOURCESUFFIX)),)
+UNITDIR_FPMAKE_RTL=$(PACKAGEDIR_RTL)/units_bs/$(SOURCESUFFIX)
+else
+UNITDIR_FPMAKE_RTL=$(PACKAGEDIR_RTL)
+endif
+endif
+ifdef CHECKDEPEND
+$(PACKAGEDIR_RTL)/$(OS_TARGET)/$(FPCMADE):
+	$(MAKE) -C $(PACKAGEDIR_RTL)/$(OS_TARGET) $(FPCMADE)
+override ALLDEPENDENCIES+=$(PACKAGEDIR_RTL)/$(OS_TARGET)/$(FPCMADE)
+endif
+else
+PACKAGEDIR_RTL=
+UNITDIR_RTL:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /rtl/Package.fpc,$(UNITSDIR)))))
+ifneq ($(UNITDIR_RTL),)
+UNITDIR_RTL:=$(firstword $(UNITDIR_RTL))
+else
+UNITDIR_RTL=
+endif
+endif
+ifdef UNITDIR_RTL
+override COMPILER_UNITDIR+=$(UNITDIR_RTL)
+endif
+ifdef UNITDIR_FPMAKE_RTL
+override COMPILER_FPMAKE_UNITDIR+=$(UNITDIR_FPMAKE_RTL)
+endif
+endif
+ifdef REQUIRE_PACKAGES_PASZLIB
+PACKAGEDIR_PASZLIB:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /paszlib/Makefile.fpc,$(PACKAGESDIR))))))
+ifneq ($(PACKAGEDIR_PASZLIB),)
+ifneq ($(wildcard $(PACKAGEDIR_PASZLIB)/units/$(TARGETSUFFIX)),)
+UNITDIR_PASZLIB=$(PACKAGEDIR_PASZLIB)/units/$(TARGETSUFFIX)
+else
+UNITDIR_PASZLIB=$(PACKAGEDIR_PASZLIB)
+endif
+ifneq ($(wildcard $(PACKAGEDIR_PASZLIB)/units/$(SOURCESUFFIX)),)
+UNITDIR_FPMAKE_PASZLIB=$(PACKAGEDIR_PASZLIB)/units/$(SOURCESUFFIX)
+else
+ifneq ($(wildcard $(PACKAGEDIR_PASZLIB)/units_bs/$(SOURCESUFFIX)),)
+UNITDIR_FPMAKE_PASZLIB=$(PACKAGEDIR_PASZLIB)/units_bs/$(SOURCESUFFIX)
+else
+UNITDIR_FPMAKE_PASZLIB=$(PACKAGEDIR_PASZLIB)
+endif
+endif
+ifdef CHECKDEPEND
+$(PACKAGEDIR_PASZLIB)/$(FPCMADE):
+	$(MAKE) -C $(PACKAGEDIR_PASZLIB) $(FPCMADE)
+override ALLDEPENDENCIES+=$(PACKAGEDIR_PASZLIB)/$(FPCMADE)
+endif
+else
+PACKAGEDIR_PASZLIB=
+UNITDIR_PASZLIB:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /paszlib/Package.fpc,$(UNITSDIR)))))
+ifneq ($(UNITDIR_PASZLIB),)
+UNITDIR_PASZLIB:=$(firstword $(UNITDIR_PASZLIB))
+else
+UNITDIR_PASZLIB=
+endif
+endif
+ifdef UNITDIR_PASZLIB
+override COMPILER_UNITDIR+=$(UNITDIR_PASZLIB)
+endif
+ifdef UNITDIR_FPMAKE_PASZLIB
+override COMPILER_FPMAKE_UNITDIR+=$(UNITDIR_FPMAKE_PASZLIB)
+endif
+endif
+ifdef REQUIRE_PACKAGES_FCL-PROCESS
+PACKAGEDIR_FCL-PROCESS:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /fcl-process/Makefile.fpc,$(PACKAGESDIR))))))
+ifneq ($(PACKAGEDIR_FCL-PROCESS),)
+ifneq ($(wildcard $(PACKAGEDIR_FCL-PROCESS)/units/$(TARGETSUFFIX)),)
+UNITDIR_FCL-PROCESS=$(PACKAGEDIR_FCL-PROCESS)/units/$(TARGETSUFFIX)
+else
+UNITDIR_FCL-PROCESS=$(PACKAGEDIR_FCL-PROCESS)
+endif
+ifneq ($(wildcard $(PACKAGEDIR_FCL-PROCESS)/units/$(SOURCESUFFIX)),)
+UNITDIR_FPMAKE_FCL-PROCESS=$(PACKAGEDIR_FCL-PROCESS)/units/$(SOURCESUFFIX)
+else
+ifneq ($(wildcard $(PACKAGEDIR_FCL-PROCESS)/units_bs/$(SOURCESUFFIX)),)
+UNITDIR_FPMAKE_FCL-PROCESS=$(PACKAGEDIR_FCL-PROCESS)/units_bs/$(SOURCESUFFIX)
+else
+UNITDIR_FPMAKE_FCL-PROCESS=$(PACKAGEDIR_FCL-PROCESS)
+endif
+endif
+ifdef CHECKDEPEND
+$(PACKAGEDIR_FCL-PROCESS)/$(FPCMADE):
+	$(MAKE) -C $(PACKAGEDIR_FCL-PROCESS) $(FPCMADE)
+override ALLDEPENDENCIES+=$(PACKAGEDIR_FCL-PROCESS)/$(FPCMADE)
+endif
+else
+PACKAGEDIR_FCL-PROCESS=
+UNITDIR_FCL-PROCESS:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /fcl-process/Package.fpc,$(UNITSDIR)))))
+ifneq ($(UNITDIR_FCL-PROCESS),)
+UNITDIR_FCL-PROCESS:=$(firstword $(UNITDIR_FCL-PROCESS))
+else
+UNITDIR_FCL-PROCESS=
+endif
+endif
+ifdef UNITDIR_FCL-PROCESS
+override COMPILER_UNITDIR+=$(UNITDIR_FCL-PROCESS)
+endif
+ifdef UNITDIR_FPMAKE_FCL-PROCESS
+override COMPILER_FPMAKE_UNITDIR+=$(UNITDIR_FPMAKE_FCL-PROCESS)
+endif
+endif
+ifdef REQUIRE_PACKAGES_HASH
+PACKAGEDIR_HASH:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /hash/Makefile.fpc,$(PACKAGESDIR))))))
+ifneq ($(PACKAGEDIR_HASH),)
+ifneq ($(wildcard $(PACKAGEDIR_HASH)/units/$(TARGETSUFFIX)),)
+UNITDIR_HASH=$(PACKAGEDIR_HASH)/units/$(TARGETSUFFIX)
+else
+UNITDIR_HASH=$(PACKAGEDIR_HASH)
+endif
+ifneq ($(wildcard $(PACKAGEDIR_HASH)/units/$(SOURCESUFFIX)),)
+UNITDIR_FPMAKE_HASH=$(PACKAGEDIR_HASH)/units/$(SOURCESUFFIX)
+else
+ifneq ($(wildcard $(PACKAGEDIR_HASH)/units_bs/$(SOURCESUFFIX)),)
+UNITDIR_FPMAKE_HASH=$(PACKAGEDIR_HASH)/units_bs/$(SOURCESUFFIX)
+else
+UNITDIR_FPMAKE_HASH=$(PACKAGEDIR_HASH)
+endif
+endif
+ifdef CHECKDEPEND
+$(PACKAGEDIR_HASH)/$(FPCMADE):
+	$(MAKE) -C $(PACKAGEDIR_HASH) $(FPCMADE)
+override ALLDEPENDENCIES+=$(PACKAGEDIR_HASH)/$(FPCMADE)
+endif
+else
+PACKAGEDIR_HASH=
+UNITDIR_HASH:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /hash/Package.fpc,$(UNITSDIR)))))
+ifneq ($(UNITDIR_HASH),)
+UNITDIR_HASH:=$(firstword $(UNITDIR_HASH))
+else
+UNITDIR_HASH=
+endif
+endif
+ifdef UNITDIR_HASH
+override COMPILER_UNITDIR+=$(UNITDIR_HASH)
+endif
+ifdef UNITDIR_FPMAKE_HASH
+override COMPILER_FPMAKE_UNITDIR+=$(UNITDIR_FPMAKE_HASH)
+endif
+endif
+ifdef REQUIRE_PACKAGES_FPMKUNIT
+PACKAGEDIR_FPMKUNIT:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /fpmkunit/Makefile.fpc,$(PACKAGESDIR))))))
+ifneq ($(PACKAGEDIR_FPMKUNIT),)
+ifneq ($(wildcard $(PACKAGEDIR_FPMKUNIT)/units/$(TARGETSUFFIX)),)
+UNITDIR_FPMKUNIT=$(PACKAGEDIR_FPMKUNIT)/units/$(TARGETSUFFIX)
+else
+UNITDIR_FPMKUNIT=$(PACKAGEDIR_FPMKUNIT)
+endif
+ifneq ($(wildcard $(PACKAGEDIR_FPMKUNIT)/units/$(SOURCESUFFIX)),)
+UNITDIR_FPMAKE_FPMKUNIT=$(PACKAGEDIR_FPMKUNIT)/units/$(SOURCESUFFIX)
+else
+ifneq ($(wildcard $(PACKAGEDIR_FPMKUNIT)/units_bs/$(SOURCESUFFIX)),)
+UNITDIR_FPMAKE_FPMKUNIT=$(PACKAGEDIR_FPMKUNIT)/units_bs/$(SOURCESUFFIX)
+else
+UNITDIR_FPMAKE_FPMKUNIT=$(PACKAGEDIR_FPMKUNIT)
+endif
+endif
+ifdef CHECKDEPEND
+$(PACKAGEDIR_FPMKUNIT)/$(FPCMADE):
+	$(MAKE) -C $(PACKAGEDIR_FPMKUNIT) $(FPCMADE)
+override ALLDEPENDENCIES+=$(PACKAGEDIR_FPMKUNIT)/$(FPCMADE)
+endif
+else
+PACKAGEDIR_FPMKUNIT=
+UNITDIR_FPMKUNIT:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /fpmkunit/Package.fpc,$(UNITSDIR)))))
+ifneq ($(UNITDIR_FPMKUNIT),)
+UNITDIR_FPMKUNIT:=$(firstword $(UNITDIR_FPMKUNIT))
+else
+UNITDIR_FPMKUNIT=
+endif
+endif
+ifdef UNITDIR_FPMKUNIT
+override COMPILER_UNITDIR+=$(UNITDIR_FPMKUNIT)
+endif
+ifdef UNITDIR_FPMAKE_FPMKUNIT
+override COMPILER_FPMAKE_UNITDIR+=$(UNITDIR_FPMAKE_FPMKUNIT)
+endif
+endif
+ifdef REQUIRE_PACKAGES_HTTPD24
+PACKAGEDIR_HTTPD24:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /HTTPD24/Makefile.fpc,$(PACKAGESDIR))))))
+ifneq ($(PACKAGEDIR_HTTPD24),)
+ifneq ($(wildcard $(PACKAGEDIR_HTTPD24)/units/$(TARGETSUFFIX)),)
+UNITDIR_HTTPD24=$(PACKAGEDIR_HTTPD24)/units/$(TARGETSUFFIX)
+else
+UNITDIR_HTTPD24=$(PACKAGEDIR_HTTPD24)
+endif
+ifneq ($(wildcard $(PACKAGEDIR_HTTPD24)/units/$(SOURCESUFFIX)),)
+UNITDIR_FPMAKE_HTTPD24=$(PACKAGEDIR_HTTPD24)/units/$(SOURCESUFFIX)
+else
+ifneq ($(wildcard $(PACKAGEDIR_HTTPD24)/units_bs/$(SOURCESUFFIX)),)
+UNITDIR_FPMAKE_HTTPD24=$(PACKAGEDIR_HTTPD24)/units_bs/$(SOURCESUFFIX)
+else
+UNITDIR_FPMAKE_HTTPD24=$(PACKAGEDIR_HTTPD24)
+endif
+endif
+ifdef CHECKDEPEND
+$(PACKAGEDIR_HTTPD24)/$(FPCMADE):
+	$(MAKE) -C $(PACKAGEDIR_HTTPD24) $(FPCMADE)
+override ALLDEPENDENCIES+=$(PACKAGEDIR_HTTPD24)/$(FPCMADE)
+endif
+else
+PACKAGEDIR_HTTPD24=
+UNITDIR_HTTPD24:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /HTTPD24/Package.fpc,$(UNITSDIR)))))
+ifneq ($(UNITDIR_HTTPD24),)
+UNITDIR_HTTPD24:=$(firstword $(UNITDIR_HTTPD24))
+else
+UNITDIR_HTTPD24=
+endif
+endif
+ifdef UNITDIR_HTTPD24
+override COMPILER_UNITDIR+=$(UNITDIR_HTTPD24)
+endif
+ifdef UNITDIR_FPMAKE_HTTPD24
+override COMPILER_FPMAKE_UNITDIR+=$(UNITDIR_FPMAKE_HTTPD24)
+endif
+endif
+ifndef NOCPUDEF
+override FPCOPTDEF=$(ARCH)
+endif
+ifneq ($(OS_TARGET),$(OS_SOURCE))
+override FPCOPT+=-T$(OS_TARGET)
+endif
+ifneq ($(CPU_TARGET),$(CPU_SOURCE))
+override FPCOPT+=-P$(ARCH)
+endif
+ifeq ($(OS_SOURCE),openbsd)
+override FPCOPT+=-FD$(NEW_BINUTILS_PATH)
+override FPCMAKEOPT+=-FD$(NEW_BINUTILS_PATH)
+endif
+ifndef CROSSBOOTSTRAP
+ifneq ($(BINUTILSPREFIX),)
+override FPCOPT+=-XP$(BINUTILSPREFIX)
+endif
+ifneq ($(BINUTILSPREFIX),)
+override FPCOPT+=-Xr$(RLINKPATH)
+endif
+endif
+ifndef CROSSCOMPILE
+ifneq ($(BINUTILSPREFIX),)
+override FPCMAKEOPT+=-XP$(BINUTILSPREFIX)
+endif
+endif
+ifdef UNITDIR
+override FPCOPT+=$(addprefix -Fu,$(UNITDIR))
+endif
+ifdef LIBDIR
+override FPCOPT+=$(addprefix -Fl,$(LIBDIR))
+endif
+ifdef OBJDIR
+override FPCOPT+=$(addprefix -Fo,$(OBJDIR))
+endif
+ifdef INCDIR
+override FPCOPT+=$(addprefix -Fi,$(INCDIR))
+endif
+ifdef LINKSMART
+override FPCOPT+=-XX
+endif
+ifdef CREATESMART
+override FPCOPT+=-CX
+endif
+ifdef DEBUG
+override FPCOPT+=-gl
+override FPCOPTDEF+=DEBUG
+endif
+ifdef RELEASE
+ifneq ($(findstring 2.0.,$(FPC_VERSION)),)
+ifeq ($(CPU_TARGET),i386)
+FPCCPUOPT:=-OG2p3
+endif
+ifeq ($(CPU_TARGET),powerpc)
+FPCCPUOPT:=-O1r
+endif
+else
+FPCCPUOPT:=-O2
+endif
+override FPCOPT+=-Ur -Xs $(FPCCPUOPT) -n
+override FPCOPTDEF+=RELEASE
+endif
+ifdef STRIP
+override FPCOPT+=-Xs
+endif
+ifdef OPTIMIZE
+override FPCOPT+=-O2
+endif
+ifdef VERBOSE
+override FPCOPT+=-vwni
+endif
+ifdef COMPILER_OPTIONS
+override FPCOPT+=$(COMPILER_OPTIONS)
+endif
+ifdef COMPILER_UNITDIR
+override FPCOPT+=$(addprefix -Fu,$(COMPILER_UNITDIR))
+endif
+ifdef COMPILER_LIBRARYDIR
+override FPCOPT+=$(addprefix -Fl,$(COMPILER_LIBRARYDIR))
+endif
+ifdef COMPILER_OBJECTDIR
+override FPCOPT+=$(addprefix -Fo,$(COMPILER_OBJECTDIR))
+endif
+ifdef COMPILER_INCLUDEDIR
+override FPCOPT+=$(addprefix -Fi,$(COMPILER_INCLUDEDIR))
+endif
+ifdef CROSSBINDIR
+override FPCOPT+=-FD$(CROSSBINDIR)
+endif
+ifdef COMPILER_TARGETDIR
+override FPCOPT+=-FE$(COMPILER_TARGETDIR)
+ifeq ($(COMPILER_TARGETDIR),.)
+override TARGETDIRPREFIX=
+else
+override TARGETDIRPREFIX=$(COMPILER_TARGETDIR)/
+endif
+endif
+ifdef COMPILER_UNITTARGETDIR
+override FPCOPT+=-FU$(COMPILER_UNITTARGETDIR)
+ifeq ($(COMPILER_UNITTARGETDIR),.)
+override UNITTARGETDIRPREFIX=
+else
+override UNITTARGETDIRPREFIX=$(COMPILER_UNITTARGETDIR)/
+endif
+else
+ifdef COMPILER_TARGETDIR
+override COMPILER_UNITTARGETDIR=$(COMPILER_TARGETDIR)
+override UNITTARGETDIRPREFIX=$(TARGETDIRPREFIX)
+endif
+endif
+ifdef CREATESHARED
+override FPCOPT+=-Cg
+ifeq ($(CPU_TARGET),i386)
+override FPCOPT+=-Aas
+endif
+endif
+ifeq ($(findstring 2.0.,$(FPC_VERSION)),)
+ifneq ($(findstring $(OS_TARGET),freebsd openbsd netbsd linux solaris),)
+ifeq ($(CPU_TARGET),x86_64)
+override FPCOPT+=-Cg
+endif
+endif
+endif
+ifdef LINKSHARED
+endif
+ifdef OPT
+override FPCOPT+=$(OPT)
+endif
+ifdef FPCOPTDEF
+override FPCOPT+=$(addprefix -d,$(FPCOPTDEF))
+endif
+ifdef CFGFILE
+override FPCOPT+=@$(CFGFILE)
+endif
+ifdef USEENV
+override FPCEXTCMD:=$(FPCOPT)
+override FPCOPT:=!FPCEXTCMD
+export FPCEXTCMD
+endif
+override AFULL_TARGET=$(CPU_TARGET)-$(OS_TARGET)
+override AFULL_SOURCE=$(CPU_SOURCE)-$(OS_SOURCE)
+ifneq ($(AFULL_TARGET),$(AFULL_SOURCE))
+override ACROSSCOMPILE=1
+endif
+ifdef ACROSSCOMPILE
+override FPCOPT+=$(CROSSOPT)
+endif
+override COMPILER:=$(FPC) $(FPCOPT)
+ifeq (,$(findstring -s ,$(COMPILER)))
+EXECPPAS=
+else
+ifeq ($(FULL_SOURCE),$(FULL_TARGET))
+ifdef RUNBATCH
+EXECPPAS:=@$(RUNBATCH) $(PPAS)
+else
+EXECPPAS:=@$(PPAS)
+endif
+endif
+endif
+.PHONY: fpc_units
+ifneq ($(TARGET_UNITS)$(TARGET_IMPLICITUNITS),)
+override ALLTARGET+=fpc_units
+override UNITPPUFILES=$(addsuffix $(PPUEXT),$(TARGET_UNITS))
+override IMPLICITUNITPPUFILES=$(addsuffix $(PPUEXT),$(TARGET_IMPLICITUNITS))
+override INSTALLPPUFILES+=$(UNITPPUFILES) $(IMPLICITUNITPPUFILES)
+override CLEANPPUFILES+=$(UNITPPUFILES) $(IMPLICITUNITPPUFILES)
+endif
+fpc_units: $(COMPILER_UNITTARGETDIR) $(UNITPPUFILES)
+.PHONY: fpc_exes
+ifndef CROSSINSTALL
+ifneq ($(TARGET_PROGRAMS),)
+override EXEFILES=$(addsuffix $(EXEEXT),$(TARGET_PROGRAMS))
+override EXEOFILES:=$(addsuffix $(OEXT),$(TARGET_PROGRAMS)) $(addprefix $(STATICLIBPREFIX),$(addsuffix $(STATICLIBEXT),$(TARGET_PROGRAMS))) $(addprefix $(IMPORTLIBPREFIX),$(addsuffix $(STATICLIBEXT),$(TARGET_PROGRAMS)))
+override EXEDBGFILES:=$(addsuffix $(EXEDBGEXT),$(TARGET_PROGRAMS))
+override ALLTARGET+=fpc_exes
+override INSTALLEXEFILES+=$(EXEFILES)
+override CLEANEXEFILES+=$(EXEFILES) $(EXEOFILES)
+override CLEANEXEDBGFILES+=$(EXEDBGFILES)
+ifeq ($(OS_TARGET),os2)
+override CLEANEXEFILES+=$(addsuffix $(AOUTEXT),$(TARGET_PROGRAMS))
+endif
+ifeq ($(OS_TARGET),emx)
+override CLEANEXEFILES+=$(addsuffix $(AOUTEXT),$(TARGET_PROGRAMS))
+endif
+endif
+endif
+fpc_exes: $(COMPILER_TARGETDIR) $(COMPILER_UNITTARGETDIR) $(EXEFILES)
+ifdef TARGET_RSTS
+override RSTFILES=$(addsuffix $(RSTEXT),$(TARGET_RSTS))
+override CLEANRSTFILES+=$(RSTFILES)
+endif
+.PHONY: fpc_all fpc_smart fpc_debug fpc_release fpc_shared
+$(FPCMADE): $(ALLDEPENDENCIES) $(ALLTARGET)
+	@$(ECHOREDIR) Compiled > $(FPCMADE)
+fpc_all: $(FPCMADE)
+fpc_smart:
+	$(MAKE) all LINKSMART=1 CREATESMART=1
+fpc_debug:
+	$(MAKE) all DEBUG=1
+fpc_release:
+	$(MAKE) all RELEASE=1
+.SUFFIXES: $(EXEEXT) $(PPUEXT) $(OEXT) .pas .lpr .dpr .pp .rc .res
+$(COMPILER_UNITTARGETDIR):
+	$(MKDIRTREE) $(COMPILER_UNITTARGETDIR)
+$(COMPILER_TARGETDIR):
+	$(MKDIRTREE) $(COMPILER_TARGETDIR)
+%$(PPUEXT): %.pp
+	$(COMPILER) $<
+	$(EXECPPAS)
+%$(PPUEXT): %.pas
+	$(COMPILER) $<
+	$(EXECPPAS)
+%$(EXEEXT): %.pp
+	$(COMPILER) $<
+	$(EXECPPAS)
+%$(EXEEXT): %.pas
+	$(COMPILER) $<
+	$(EXECPPAS)
+%$(EXEEXT): %.lpr
+	$(COMPILER) $<
+	$(EXECPPAS)
+%$(EXEEXT): %.dpr
+	$(COMPILER) $<
+	$(EXECPPAS)
+%.res: %.rc
+	windres -i $< -o $@
+vpath %.pp $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR)
+vpath %.pas $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR)
+vpath %.lpr $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR)
+vpath %.dpr $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR)
+vpath %.inc $(COMPILER_INCLUDEDIR)
+vpath %$(OEXT) $(COMPILER_UNITTARGETDIR)
+vpath %$(PPUEXT) $(COMPILER_UNITTARGETDIR)
+.PHONY: fpc_shared
+override INSTALLTARGET+=fpc_shared_install
+ifndef SHARED_LIBVERSION
+SHARED_LIBVERSION=$(FPC_VERSION)
+endif
+ifndef SHARED_LIBNAME
+SHARED_LIBNAME=$(PACKAGE_NAME)
+endif
+ifndef SHARED_FULLNAME
+SHARED_FULLNAME=$(SHAREDLIBPREFIX)$(SHARED_LIBNAME)-$(SHARED_LIBVERSION)$(SHAREDLIBEXT)
+endif
+ifndef SHARED_LIBUNITS
+SHARED_LIBUNITS:=$(TARGET_UNITS) $(TARGET_IMPLICITUNITS)
+override SHARED_LIBUNITS:=$(filter-out $(INSTALL_BUILDUNIT),$(SHARED_LIBUNITS))
+endif
+fpc_shared:
+ifdef HASSHAREDLIB
+	$(MAKE) all CREATESHARED=1 LINKSHARED=1 CREATESMART=1
+ifneq ($(SHARED_BUILD),n)
+	$(PPUMOVE) -q $(SHARED_LIBUNITS) -i$(COMPILER_UNITTARGETDIR) -o$(SHARED_FULLNAME) -d$(COMPILER_UNITTARGETDIR)
+endif
+else
+	@$(ECHO) Shared Libraries not supported
+endif
+fpc_shared_install:
+ifneq ($(SHARED_BUILD),n)
+ifneq ($(SHARED_LIBUNITS),)
+ifneq ($(wildcard $(COMPILER_UNITTARGETDIR)/$(SHARED_FULLNAME)),)
+	$(INSTALL) $(COMPILER_UNITTARGETDIR)/$(SHARED_FULLNAME) $(INSTALL_SHAREDDIR)
+endif
+endif
+endif
+.PHONY: fpc_install fpc_sourceinstall fpc_exampleinstall
+ifdef INSTALL_UNITS
+override INSTALLPPUFILES+=$(addsuffix $(PPUEXT),$(INSTALL_UNITS))
+endif
+ifdef INSTALL_BUILDUNIT
+override INSTALLPPUFILES:=$(filter-out $(INSTALL_BUILDUNIT)$(PPUEXT),$(INSTALLPPUFILES))
+endif
+ifdef INSTALLPPUFILES
+override INSTALLPPULINKFILES:=$(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)) $(addprefix $(STATICLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(INSTALLPPUFILES))) $(addprefix $(IMPORTLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(INSTALLPPUFILES)))
+ifneq ($(UNITTARGETDIRPREFIX),)
+override INSTALLPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(notdir $(INSTALLPPUFILES)))
+override INSTALLPPULINKFILES:=$(wildcard $(addprefix $(UNITTARGETDIRPREFIX),$(notdir $(INSTALLPPULINKFILES))))
+endif
+override INSTALL_CREATEPACKAGEFPC=1
+endif
+ifdef INSTALLEXEFILES
+ifneq ($(TARGETDIRPREFIX),)
+override INSTALLEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(notdir $(INSTALLEXEFILES)))
+endif
+endif
+fpc_install: all $(INSTALLTARGET)
+ifdef INSTALLEXEFILES
+	$(MKDIR) $(INSTALL_BINDIR)
+	$(INSTALLEXE) $(INSTALLEXEFILES) $(INSTALL_BINDIR)
+endif
+ifdef INSTALL_CREATEPACKAGEFPC
+ifdef FPCMAKE
+ifdef PACKAGE_VERSION
+ifneq ($(wildcard Makefile.fpc),)
+	$(FPCMAKE) -p -T$(CPU_TARGET)-$(OS_TARGET) Makefile.fpc
+	$(MKDIR) $(INSTALL_UNITDIR)
+	$(INSTALL) Package.fpc $(INSTALL_UNITDIR)
+endif
+endif
+endif
+endif
+ifdef INSTALLPPUFILES
+	$(MKDIR) $(INSTALL_UNITDIR)
+	$(INSTALL) $(INSTALLPPUFILES) $(INSTALL_UNITDIR)
+ifneq ($(INSTALLPPULINKFILES),)
+	$(INSTALL) $(INSTALLPPULINKFILES) $(INSTALL_UNITDIR)
+endif
+ifneq ($(wildcard $(LIB_FULLNAME)),)
+	$(MKDIR) $(INSTALL_LIBDIR)
+	$(INSTALL) $(LIB_FULLNAME) $(INSTALL_LIBDIR)
+ifdef inUnix
+	ln -sf $(LIB_FULLNAME) $(INSTALL_LIBDIR)/$(LIB_NAME)
+endif
+endif
+endif
+ifdef INSTALL_FILES
+	$(MKDIR) $(INSTALL_DATADIR)
+	$(INSTALL) $(INSTALL_FILES) $(INSTALL_DATADIR)
+endif
+fpc_sourceinstall: distclean
+	$(MKDIR) $(INSTALL_SOURCEDIR)
+	$(COPYTREE) $(BASEDIR)/* $(INSTALL_SOURCEDIR)
+fpc_exampleinstall: $(addsuffix _distclean,$(TARGET_EXAMPLEDIRS))
+ifdef HASEXAMPLES
+	$(MKDIR) $(INSTALL_EXAMPLEDIR)
+endif
+ifdef EXAMPLESOURCEFILES
+	$(COPY) $(EXAMPLESOURCEFILES) $(INSTALL_EXAMPLEDIR)
+endif
+ifdef TARGET_EXAMPLEDIRS
+	$(COPYTREE) $(addsuffix /*,$(TARGET_EXAMPLEDIRS)) $(INSTALL_EXAMPLEDIR)
+endif
+.PHONY: fpc_clean fpc_cleanall fpc_distclean
+ifdef EXEFILES
+override CLEANEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(CLEANEXEFILES))
+override CLEANEXEDBGFILES:=$(addprefix $(TARGETDIRPREFIX),$(CLEANEXEDBGFILES))
+endif
+ifdef CLEAN_PROGRAMS
+override CLEANEXEFILES+=$(addprefix $(TARGETDIRPREFIX),$(addsuffix $(EXEEXT), $(CLEAN_PROGRAMS)))
+override CLEANEXEDBGFILES+=$(addprefix $(TARGETDIRPREFIX),$(addsuffix $(EXEDBGEXT), $(CLEAN_PROGRAMS)))
+endif
+ifdef CLEAN_UNITS
+override CLEANPPUFILES+=$(addsuffix $(PPUEXT),$(CLEAN_UNITS))
+endif
+ifdef CLEANPPUFILES
+override CLEANPPULINKFILES:=$(subst $(PPUEXT),$(OEXT),$(CLEANPPUFILES)) $(addprefix $(STATICLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(CLEANPPUFILES))) $(addprefix $(IMPORTLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(CLEANPPUFILES)))
+ifdef DEBUGSYMEXT
+override CLEANPPULINKFILES+=$(subst $(PPUEXT),$(DEBUGSYMEXT),$(CLEANPPUFILES))
+endif
+override CLEANPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPUFILES))
+override CLEANPPULINKFILES:=$(wildcard $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPULINKFILES)))
+endif
+fpc_clean: $(CLEANTARGET)
+ifdef CLEANEXEFILES
+	-$(DEL) $(CLEANEXEFILES)
+endif
+ifdef CLEANEXEDBGFILES
+	-$(DELTREE) $(CLEANEXEDBGFILES)
+endif
+ifdef CLEANPPUFILES
+	-$(DEL) $(CLEANPPUFILES)
+endif
+ifneq ($(CLEANPPULINKFILES),)
+	-$(DEL) $(CLEANPPULINKFILES)
+endif
+ifdef CLEANRSTFILES
+	-$(DEL) $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANRSTFILES))
+endif
+ifdef CLEAN_FILES
+	-$(DEL) $(CLEAN_FILES)
+endif
+ifdef LIB_NAME
+	-$(DEL) $(LIB_NAME) $(LIB_FULLNAME)
+endif
+	-$(DEL) $(FPCMADE) Package.fpc $(PPAS) script.res link.res $(FPCEXTFILE) $(REDIRFILE)
+	-$(DEL) *$(ASMEXT) *_ppas$(BATCHEXT)
+fpc_cleanall: $(CLEANTARGET)
+ifdef CLEANEXEFILES
+	-$(DEL) $(CLEANEXEFILES)
+endif
+ifdef COMPILER_UNITTARGETDIR
+ifdef CLEANPPUFILES
+	-$(DEL) $(CLEANPPUFILES)
+endif
+ifneq ($(CLEANPPULINKFILES),)
+	-$(DEL) $(CLEANPPULINKFILES)
+endif
+ifdef CLEANRSTFILES
+	-$(DEL) $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANRSTFILES))
+endif
+endif
+ifdef CLEAN_FILES
+	-$(DEL) $(CLEAN_FILES)
+endif
+	-$(DELTREE) units
+	-$(DEL) *$(OEXT) *$(PPUEXT) *$(RSTEXT) *$(ASMEXT) *$(STATICLIBEXT) *$(SHAREDLIBEXT) *$(PPLEXT)
+ifneq ($(PPUEXT),.ppu)
+	-$(DEL) *.o *.ppu *.a
+endif
+	-$(DELTREE) *$(SMARTEXT)
+	-$(DEL) fpcmade.* Package.fpc $(PPAS) script.res link.res $(FPCEXTFILE) $(REDIRFILE)
+	-$(DEL) *_ppas$(BATCHEXT)
+ifdef AOUTEXT
+	-$(DEL) *$(AOUTEXT)
+endif
+ifdef DEBUGSYMEXT
+	-$(DEL) *$(DEBUGSYMEXT)
+endif
+fpc_distclean: cleanall
+.PHONY: fpc_baseinfo
+override INFORULES+=fpc_baseinfo
+fpc_baseinfo:
+	@$(ECHO)
+	@$(ECHO)  == Package info ==
+	@$(ECHO)  Package Name..... $(PACKAGE_NAME)
+	@$(ECHO)  Package Version.. $(PACKAGE_VERSION)
+	@$(ECHO)
+	@$(ECHO)  == Configuration info ==
+	@$(ECHO)
+	@$(ECHO)  FPC.......... $(FPC)
+	@$(ECHO)  FPC Version.. $(FPC_VERSION)
+	@$(ECHO)  Source CPU... $(CPU_SOURCE)
+	@$(ECHO)  Target CPU... $(CPU_TARGET)
+	@$(ECHO)  Source OS.... $(OS_SOURCE)
+	@$(ECHO)  Target OS.... $(OS_TARGET)
+	@$(ECHO)  Full Source.. $(FULL_SOURCE)
+	@$(ECHO)  Full Target.. $(FULL_TARGET)
+	@$(ECHO)  SourceSuffix. $(SOURCESUFFIX)
+	@$(ECHO)  TargetSuffix. $(TARGETSUFFIX)
+	@$(ECHO)  FPC fpmake... $(FPCFPMAKE)
+	@$(ECHO)
+	@$(ECHO)  == Directory info ==
+	@$(ECHO)
+	@$(ECHO)  Required pkgs... $(REQUIRE_PACKAGES)
+	@$(ECHO)
+	@$(ECHO)  Basedir......... $(BASEDIR)
+	@$(ECHO)  FPCDir.......... $(FPCDIR)
+	@$(ECHO)  CrossBinDir..... $(CROSSBINDIR)
+	@$(ECHO)  UnitsDir........ $(UNITSDIR)
+	@$(ECHO)  PackagesDir..... $(PACKAGESDIR)
+	@$(ECHO)
+	@$(ECHO)  GCC library..... $(GCCLIBDIR)
+	@$(ECHO)  Other library... $(OTHERLIBDIR)
+	@$(ECHO)
+	@$(ECHO)  == Tools info ==
+	@$(ECHO)
+	@$(ECHO)  As........ $(AS)
+	@$(ECHO)  Ld........ $(LD)
+	@$(ECHO)  Ar........ $(AR)
+	@$(ECHO)  Rc........ $(RC)
+	@$(ECHO)
+	@$(ECHO)  Mv........ $(MVPROG)
+	@$(ECHO)  Cp........ $(CPPROG)
+	@$(ECHO)  Rm........ $(RMPROG)
+	@$(ECHO)  GInstall.. $(GINSTALL)
+	@$(ECHO)  Echo...... $(ECHO)
+	@$(ECHO)  Shell..... $(SHELL)
+	@$(ECHO)  Date...... $(DATE)
+	@$(ECHO)  FPCMake... $(FPCMAKE)
+	@$(ECHO)  PPUMove... $(PPUMOVE)
+	@$(ECHO)  Zip....... $(ZIPPROG)
+	@$(ECHO)
+	@$(ECHO)  == Object info ==
+	@$(ECHO)
+	@$(ECHO)  Target Loaders........ $(TARGET_LOADERS)
+	@$(ECHO)  Target Units.......... $(TARGET_UNITS)
+	@$(ECHO)  Target Implicit Units. $(TARGET_IMPLICITUNITS)
+	@$(ECHO)  Target Programs....... $(TARGET_PROGRAMS)
+	@$(ECHO)  Target Dirs........... $(TARGET_DIRS)
+	@$(ECHO)  Target Examples....... $(TARGET_EXAMPLES)
+	@$(ECHO)  Target ExampleDirs.... $(TARGET_EXAMPLEDIRS)
+	@$(ECHO)
+	@$(ECHO)  Clean Units......... $(CLEAN_UNITS)
+	@$(ECHO)  Clean Files......... $(CLEAN_FILES)
+	@$(ECHO)
+	@$(ECHO)  Install Units....... $(INSTALL_UNITS)
+	@$(ECHO)  Install Files....... $(INSTALL_FILES)
+	@$(ECHO)
+	@$(ECHO)  == Install info ==
+	@$(ECHO)
+	@$(ECHO)  DateStr.............. $(DATESTR)
+	@$(ECHO)  ZipName.............. $(ZIPNAME)
+	@$(ECHO)  ZipPrefix............ $(ZIPPREFIX)
+	@$(ECHO)  ZipCrossPrefix....... $(ZIPCROSSPREFIX)
+	@$(ECHO)  ZipSuffix............ $(ZIPSUFFIX)
+	@$(ECHO)  FullZipName.......... $(FULLZIPNAME)
+	@$(ECHO)  Install FPC Package.. $(INSTALL_FPCPACKAGE)
+	@$(ECHO)
+	@$(ECHO)  Install base dir..... $(INSTALL_BASEDIR)
+	@$(ECHO)  Install binary dir... $(INSTALL_BINDIR)
+	@$(ECHO)  Install library dir.. $(INSTALL_LIBDIR)
+	@$(ECHO)  Install units dir.... $(INSTALL_UNITDIR)
+	@$(ECHO)  Install source dir... $(INSTALL_SOURCEDIR)
+	@$(ECHO)  Install doc dir...... $(INSTALL_DOCDIR)
+	@$(ECHO)  Install example dir.. $(INSTALL_EXAMPLEDIR)
+	@$(ECHO)  Install data dir..... $(INSTALL_DATADIR)
+	@$(ECHO)
+	@$(ECHO)  Dist destination dir. $(DIST_DESTDIR)
+	@$(ECHO)  Dist zip name........ $(DIST_ZIPNAME)
+	@$(ECHO)
+.PHONY: fpc_info
+fpc_info: $(INFORULES)
+.PHONY: fpc_makefile fpc_makefiles fpc_makefile_sub1 fpc_makefile_sub2 \
+	fpc_makefile_dirs
+fpc_makefile:
+	$(FPCMAKE) -w -T$(OS_TARGET) Makefile.fpc
+fpc_makefile_sub1:
+ifdef TARGET_DIRS
+	$(FPCMAKE) -w -T$(OS_TARGET) $(addsuffix /Makefile.fpc,$(TARGET_DIRS))
+endif
+ifdef TARGET_EXAMPLEDIRS
+	$(FPCMAKE) -w -T$(OS_TARGET) $(addsuffix /Makefile.fpc,$(TARGET_EXAMPLEDIRS))
+endif
+fpc_makefile_sub2: $(addsuffix _makefile_dirs,$(TARGET_DIRS) $(TARGET_EXAMPLEDIRS))
+fpc_makefile_dirs: fpc_makefile_sub1 fpc_makefile_sub2
+fpc_makefiles: fpc_makefile fpc_makefile_dirs
+all: fpc_all
+debug: fpc_debug
+smart: fpc_smart
+release: fpc_release
+units: fpc_units
+examples:
+shared: fpc_shared
+install: fpc_install
+sourceinstall: fpc_sourceinstall
+exampleinstall: fpc_exampleinstall
+distinstall:
+zipinstall:
+zipsourceinstall:
+zipexampleinstall:
+zipdistinstall:
+clean: fpc_clean
+distclean: fpc_distclean
+cleanall: fpc_cleanall
+info: fpc_info
+makefiles: fpc_makefiles
+.PHONY: all debug smart release units examples shared install sourceinstall exampleinstall distinstall zipinstall zipsourceinstall zipexampleinstall zipdistinstall clean distclean cleanall info makefiles
+ifneq ($(wildcard fpcmake.loc),)
+include fpcmake.loc
+endif
+.NOTPARALLEL:

+ 19 - 0
packages/httpd24/examples/Makefile.fpc

@@ -0,0 +1,19 @@
+#
+#  Makefile.fpc for apache2.0 units example
+#
+
+[target]
+units=minimain
+programs=mod_hello
+
+[require]
+packages=httpd24
+
+[install]
+fpcpackage=y
+
+[default]
+fpcdir=../../..
+
+[rules]
+.NOTPARALLEL:

+ 105 - 0
packages/httpd24/examples/mod_hello.pp

@@ -0,0 +1,105 @@
+{*******************************************************************
+*  Test library of the Apache Pascal Headers
+*******************************************************************}
+library mod_hello;
+
+{$mode objfpc}{$H+}
+
+uses SysUtils, httpd24, apr;
+
+const
+  MODULE_NAME = 'hello_module';
+
+var
+  test_module: module;{$ifdef unix} public name MODULE_NAME;{$endif}
+  
+exports
+  test_module name MODULE_NAME;
+
+{*******************************************************************
+*  Handles apache requests
+*******************************************************************}
+function DefaultHandler(r: Prequest_rec): Integer; cdecl;
+var
+  RequestedHandler, onerow: string;
+
+  
+begin
+  RequestedHandler := r^.handler;
+
+  { We decline to handle a request if r->handler is not the value of MODULE_NAME}
+  if not SameText(RequestedHandler, MODULE_NAME) then
+  begin
+    Result := DECLINED;
+    Exit;
+  end;
+
+  { The following line just prints a message to the errorlog }
+  ap_log_error(MODULE_NAME,                         //The file in which this function is called
+               40,                                  //The line number on which this function is called
+               0,                                   //The module_index of the module generating this message
+               APLOG_NOERRNO or APLOG_NOTICE,       //The level of this error message
+               0,                                   //The status code from the previous command
+               r^.server,                           //The server on which we are logging
+               'mod_hello: %s',                     //The format string
+               [PChar('Before content is output')]); //The arguments to use to fill out fmt.
+
+  ap_set_content_type(r, 'text/html');
+
+  { If the request is for a header only, and not a request for
+   the whole content, then return OK now. We don't have to do
+   anything else. }
+  if (r^.header_only <> 0) then
+  begin
+    Result := OK;
+    Exit;
+  end;
+
+  { Now we just print the contents of the document using the
+   ap_rputs and ap_rprintf functions. More information about
+   the use of these can be found in http_protocol.inc }
+  onerow := '<HTML>' + LineEnding;
+  ap_rwrite(PChar(onerow), length(onerow), r);
+  onerow := '<HEAD>' + LineEnding;
+  ap_rwrite(PChar(onerow), length(onerow), r);
+  onerow := '<TITLE>Hello There</TITLE>' + LineEnding;
+  ap_rwrite(PChar(onerow), length(onerow), r);
+  onerow := '</HEAD>' + LineEnding;
+  ap_rwrite(PChar(onerow), length(onerow), r);
+  onerow := '<BODY BGCOLOR="#FFFFFF">' + LineEnding;
+  ap_rwrite(PChar(onerow), length(onerow), r);
+  onerow := '<H1>Hello world</H1>' + LineEnding;
+  ap_rwrite(PChar(onerow), length(onerow), r);
+  onerow := 'This is an Apache Module working with the binding from Free Pascal' + LineEnding;
+  ap_rwrite(PChar(onerow), length(onerow), r);
+  onerow := '</BODY></HTML>' + LineEnding;
+  ap_rwrite(PChar(onerow), length(onerow), r);
+
+  { We can either return OK or DECLINED at this point. If we return
+         * OK, then no other modules will attempt to process this request }
+  Result := OK;
+end;
+
+{*******************************************************************
+*  Registers the hooks
+*******************************************************************}
+procedure RegisterHooks(p: Papr_pool_t); cdecl;
+begin
+  ap_hook_handler(@DefaultHandler, nil, nil, APR_HOOK_MIDDLE);
+end;
+
+{*******************************************************************
+*  Library initialization code
+*******************************************************************}
+
+begin
+  FillChar(test_module, SizeOf(test_module),0);
+
+  STANDARD20_MODULE_STUFF(test_module);
+
+  with test_module do
+  begin
+    name := MODULE_NAME;
+    register_hooks := @RegisterHooks;
+  end;
+end.

+ 76 - 0
packages/httpd24/fpmake.pp

@@ -0,0 +1,76 @@
+{$ifndef ALLPACKAGES}
+{$mode objfpc}{$H+}
+program fpmake;
+
+uses fpmkunit;
+
+Var
+  P : TPackage;
+  T : TTarget;
+begin
+  With Installer do
+    begin
+{$endif ALLPACKAGES}
+
+    P:=AddPackage('httpd24');
+{$ifdef ALLPACKAGES}
+    P.Directory:='httpd24';
+{$endif ALLPACKAGES}
+    P.Version:='2.7.1';
+    P.Author := 'Library: Apache Foundation, header: Felipe Monteiro de Carvalho';
+    P.License := 'Library: Apache License 2, header: LGPL with modification, ';
+    P.HomepageURL := 'www.freepascal.org';
+    P.Email := '';
+    P.Description := 'Headers for the Apache 2.4 series www server';
+    P.NeedLibC:= true;  // true for headers that indirectly link to libc?
+    P.OSes := AllUnixOSes+AllWindowsOSes-[qnx];
+
+    P.SourcePath.Add('src');
+    P.SourcePath.Add('src/apr');
+    P.SourcePath.Add('src/aprutil');
+    P.IncludePath.Add('src');
+    P.IncludePath.Add('src/apr');
+    P.IncludePath.Add('src/aprutil');
+
+//    P.Dependencies.Add('x11');
+
+    T:=P.Targets.AddUnit('apr24.pas');
+      with T.Dependencies do
+        begin
+          AddInclude('apr_errno.inc');
+          AddInclude('apr_pools.inc');
+          AddInclude('apr_allocator.inc');
+          AddInclude('apr_user.inc');
+          AddInclude('apr_time.inc');
+          AddInclude('apr_tables.inc');
+          AddInclude('apr_file_info.inc');
+          AddInclude('apr_strings.inc');
+          AddInclude('apr_version.inc');
+        end;
+    T:=P.Targets.AddUnit('httpd24.pas');
+      with T.Dependencies do
+        begin
+          AddInclude('util_cfgtree.inc');
+          AddInclude('httpd.inc');
+          AddInclude('ap_config.inc');
+          AddInclude('ap_mmn.inc');
+          AddInclude('ap_release.inc');
+          AddInclude('ap_regex.inc');
+          AddInclude('http_config.inc');
+          AddInclude('http_core.inc');
+          AddInclude('util_filter.inc');
+          AddInclude('http_log.inc');
+          AddInclude('http_protocol.inc');
+          AddInclude('aprutil/apr_buckets.inc');
+          AddInclude('aprutil/apr_uri.inc');
+          AddUnit('apr24');
+        end;
+    P.ExamplePath.Add('examples');
+    T:=P.Targets.AddExampleProgram('mod_hello.pp');
+
+{$ifndef ALLPACKAGES}
+    Run;
+    end;
+end.
+{$endif ALLPACKAGES}
+

+ 210 - 0
packages/httpd24/src/ap_config.inc

@@ -0,0 +1,210 @@
+{* 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.
+ *}
+
+{**
+ * @file ap_config.h
+ * @brief Symbol export macros and hook functions
+ *}
+
+{$ifndef AP_CONFIG_H}
+  {$define AP_CONFIG_H}
+
+//#include "ap_hooks.h"
+
+{* Although this file doesn't declare any hooks, declare the exports group here *}
+{**
+ * @defgroup exports Apache exports
+ * @ingroup  APACHE_CORE
+ *}
+
+  {$ifdef DOXYGEN}
+{* define these just so doxygen documents them *}
+
+{**
+ * AP_DECLARE_STATIC is defined when including Apache's Core headers,
+ * to provide static linkage when the dynamic library may be unavailable.
+ *
+ * @see AP_DECLARE_EXPORT
+ *
+ * AP_DECLARE_STATIC and AP_DECLARE_EXPORT are left undefined when
+ * including Apache's Core headers, to import and link the symbols from the
+ * dynamic Apache Core library and assure appropriate indirection and calling
+ * conventions at compile time.
+ *}
+    {$define AP_DECLARE_STATIC}
+{**
+ * AP_DECLARE_EXPORT is defined when building the Apache Core dynamic
+ * library, so that all public symbols are exported.
+ *
+ * @see AP_DECLARE_STATIC
+ *}
+    {$define AP_DECLARE_EXPORT}
+
+  {$endif} {* def DOXYGEN *}
+
+(* freepascal: calling conventions are handled individually at the
+   function/procedure declarations*)
+{*
+#if !defined(WIN32)
+/**
+ * Apache Core dso functions are declared with AP_DECLARE(), so they may
+ * use the most appropriate calling convention.  Hook functions and other
+ * Core functions with variable arguments must use AP_DECLARE_NONSTD().
+ * @code
+ * AP_DECLARE(rettype) ap_func(args)
+ * @endcode
+ */
+#define AP_DECLARE(type)            type
+
+/**
+ * Apache Core dso variable argument and hook functions are declared with
+ * AP_DECLARE_NONSTD(), as they must use the C language calling convention.
+ * @see AP_DECLARE
+ * @code
+ * AP_DECLARE_NONSTD(rettype) ap_func(args [...])
+ * @endcode
+ */
+#define AP_DECLARE_NONSTD(type)     type
+
+/**
+ * Apache Core dso variables are declared with AP_MODULE_DECLARE_DATA.
+ * This assures the appropriate indirection is invoked at compile time.
+ *
+ * @note AP_DECLARE_DATA extern type apr_variable; syntax is required for
+ * declarations within headers to properly import the variable.
+ * @code
+ * AP_DECLARE_DATA type apr_variable
+ * @endcode
+ */
+#define AP_DECLARE_DATA
+
+#elif defined(AP_DECLARE_STATIC)
+#define AP_DECLARE(type)            type __stdcall
+#define AP_DECLARE_NONSTD(type)     type
+#define AP_DECLARE_DATA
+#elif defined(AP_DECLARE_EXPORT)
+#define AP_DECLARE(type)            __declspec(dllexport) type __stdcall
+#define AP_DECLARE_NONSTD(type)     __declspec(dllexport) type
+#define AP_DECLARE_DATA             __declspec(dllexport)
+#else
+#define AP_DECLARE(type)            __declspec(dllimport) type __stdcall
+#define AP_DECLARE_NONSTD(type)     __declspec(dllimport) type
+#define AP_DECLARE_DATA             __declspec(dllimport)
+#endif
+
+#if !defined(WIN32) || defined(AP_MODULE_DECLARE_STATIC)
+/**
+ * Declare a dso module's exported module structure as AP_MODULE_DECLARE_DATA.
+ *
+ * Unless AP_MODULE_DECLARE_STATIC is defined at compile time, symbols
+ * declared with AP_MODULE_DECLARE_DATA are always exported.
+ * @code
+ * module AP_MODULE_DECLARE_DATA mod_tag
+ * @endcode
+ */
+#if defined(WIN32)
+#define AP_MODULE_DECLARE(type)            type __stdcall
+#else
+#define AP_MODULE_DECLARE(type)            type
+#endif
+#define AP_MODULE_DECLARE_NONSTD(type)     type
+#define AP_MODULE_DECLARE_DATA
+#else
+/**
+ * AP_MODULE_DECLARE_EXPORT is a no-op.  Unless contradicted by the
+ * AP_MODULE_DECLARE_STATIC compile-time symbol, it is assumed and defined.
+ *
+ * The old SHARED_MODULE compile-time symbol is now the default behavior,
+ * so it is no longer referenced anywhere with Apache 2.0.
+ */
+#define AP_MODULE_DECLARE_EXPORT
+#define AP_MODULE_DECLARE(type)          __declspec(dllexport) type __stdcall
+#define AP_MODULE_DECLARE_NONSTD(type)   __declspec(dllexport) type
+#define AP_MODULE_DECLARE_DATA           __declspec(dllexport)
+#endif
+
+#include "os.h"
+#if (!defined(WIN32) && !defined(NETWARE)) || defined(__MINGW32__)
+#include "ap_config_auto.h"
+#endif
+#include "ap_config_layout.h"
+
+/* Where the main/parent process's pid is logged */
+#ifndef DEFAULT_PIDLOG
+#define DEFAULT_PIDLOG DEFAULT_REL_RUNTIMEDIR "/httpd.pid"
+#endif
+
+#if defined(NETWARE)
+#define AP_NONBLOCK_WHEN_MULTI_LISTEN 1
+#endif
+
+#if defined(AP_ENABLE_DTRACE) && HAVE_SYS_SDT_H
+#include <sys/sdt.h>
+#else
+#undef _DTRACE_VERSION
+#endif
+
+#ifdef _DTRACE_VERSION
+#include "apache_probes.h"
+#else
+#include "apache_noprobes.h"
+#endif
+
+/* If APR has OTHER_CHILD logic, use reliable piped logs. */
+#if APR_HAS_OTHER_CHILD
+#define AP_HAVE_RELIABLE_PIPED_LOGS TRUE
+#endif
+
+#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+#define AP_HAVE_C99
+#endif
+
+/* Presume that the compiler supports C99-style designated
+ * initializers if using GCC (but not G++), or for any other compiler
+ * which claims C99 support. */
+#if (defined(__GNUC__) && !defined(__cplusplus)) || defined(AP_HAVE_C99)
+#define AP_HAVE_DESIGNATED_INITIALIZER
+#endif
+
+#ifndef __has_attribute         /* check for supported attributes on clang */
+#define __has_attribute(x) 0
+#endif
+#if (defined(__GNUC__) && __GNUC__ >= 4) || __has_attribute(sentinel)
+#define AP_FN_ATTR_SENTINEL __attribute__((sentinel))
+#else
+#define AP_FN_ATTR_SENTINEL
+#endif
+
+#if ( defined(__GNUC__) &&                                        \
+      (__GNUC__ >= 4 || ( __GNUC__ == 3 && __GNUC_MINOR__ >= 4))) \
+    || __has_attribute(warn_unused_result)
+#define AP_FN_ATTR_WARN_UNUSED_RESULT   __attribute__((warn_unused_result))
+#else
+#define AP_FN_ATTR_WARN_UNUSED_RESULT
+#endif
+
+#if ( defined(__GNUC__) &&                                        \
+      (__GNUC__ >= 4 && __GNUC_MINOR__ >= 3))                     \
+    || __has_attribute(alloc_size)
+#define AP_FN_ATTR_ALLOC_SIZE(x)     __attribute__((alloc_size(x)))
+#define AP_FN_ATTR_ALLOC_SIZE2(x,y)  __attribute__((alloc_size(x,y)))
+#else
+#define AP_FN_ATTR_ALLOC_SIZE(x)
+#define AP_FN_ATTR_ALLOC_SIZE2(x,y)
+#endif
+*}
+{$endif} {* AP_CONFIG_H *}
+

+ 450 - 0
packages/httpd24/src/ap_expr.inc

@@ -0,0 +1,450 @@
+{* 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.
+ *}
+
+(**
+ * @file ap_expr.h
+ * @brief Expression parser
+ *
+ * @defgroup AP_EXPR Expression parser
+ * @ingroup  APACHE_CORE
+ * @{
+ *)
+
+//#ifndef AP_EXPR_H
+//#define AP_EXPR_H
+
+//#include "httpd.h"
+//#include "http_config.h"
+//#include "ap_regex.h"
+
+
+//** A node in the expression parse tree */
+//typedef struct ap_expr_node ap_expr_t;
+type
+  ap_expr_node_op_e = (
+      op_NOP,
+      op_True, op_False,
+      op_Not, op_Or, op_And,
+      op_Comp,
+      op_EQ, op_NE, op_LT, op_LE, op_GT, op_GE, op_IN,
+      op_REG, op_NRE,
+      op_STR_EQ, op_STR_NE, op_STR_LT, op_STR_LE, op_STR_GT, op_STR_GE,
+      op_Concat,
+      op_Digit, op_String, op_Regex, op_RegexBackref,
+      op_Var,
+      op_ListElement,
+      {*
+       * call external functions/operators.
+       * The info node contains the function pointer and some function specific
+       * info.
+       * For Binary operators, the Call node links to the Info node and the
+       * Args node, which in turn links to the left and right operand.
+       * For all other variants, the Call node links to the Info node and the
+       * argument.
+       *}
+      op_UnaryOpCall, op_UnaryOpInfo,
+      op_BinaryOpCall, op_BinaryOpInfo, op_BinaryOpArgs,
+      op_StringFuncCall, op_StringFuncInfo,
+      op_ListFuncCall, op_ListFuncInfo
+  );
+
+  ap_expr_node = record        {fpc -> from httpd-X-X-X/server/util_expr_private.h}
+    node_op: ap_expr_node_op_e;
+    node_arg1: Pointer;
+    node_arg2: Pointer;
+  end;
+  ap_expr_t = ap_expr_node;
+  Pap_expr_t = ^ap_expr_t;
+
+//** Struct describing a parsed expression */
+  Pap_expr_info_t = ^ap_expr_info_t;
+  ap_expr_info_t = record
+    //** The root of the actual expression parse tree */
+    root_node: Pap_expr_t;
+    {** The filename where the expression has been defined (for logging).
+     *  May be NULL
+     *}
+    filename: PChar;
+    //** The line number where the expression has been defined (for logging). */
+    line_number: cuint;
+    //** Flags relevant for the expression, see AP_EXPR_FLAG_* */
+    flags: cuint;
+    //** The module that is used for loglevel configuration */
+    module_index: Integer;
+  end; {ap_expr_info_t}
+
+{** Use ssl_expr compatibility mode (changes the meaning of the comparison
+ * operators)
+ *}
+const
+  AP_EXPR_FLAG_SSL_EXPR_COMPAT = 1;
+//** Don't add siginificant request headers to the Vary response header */
+  AP_EXPR_FLAG_DONT_VARY       = 2;
+{** Don't allow functions/vars that bypass the current request's access
+ *  restrictions or would otherwise leak confidential information.
+ *  Used by e.g. mod_include.
+ *}
+  AP_EXPR_FLAG_RESTRICTED      = 4;
+//** Expression evaluates to a string, not to a bool */
+  AP_EXPR_FLAG_STRING_RESULT   = 8;
+
+
+{**
+ * Evaluate a parse tree, simple interface
+ * @param r The current request
+ * @param expr The expression to be evaluated
+ * @param err Where an error message should be stored
+ * @return > 0 if expression evaluates to true, == 0 if false, < 0 on error
+ * @note err will be set to NULL on success, or to an error message on error
+ * @note request headers used during evaluation will be added to the Vary:
+ *       response header, unless ::AP_EXPR_FLAG_DONT_VARY is set.
+ *}
+//AP_DECLARE(int) ap_expr_exec(request_rec *r, const ap_expr_info_t *expr,
+//                             const char **err);
+function ap_expr_exec(r: Prequest_rec; const expr: Pap_expr_info_t; err: PPChar): Integer;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name LibNamePrefix + 'ap_expr_exec' + LibSuff12;
+
+{**
+ * Evaluate a parse tree, with access to regexp backreference
+ * @param r The current request
+ * @param expr The expression to be evaluated
+ * @param nmatch size of the regex match vector pmatch
+ * @param pmatch information about regex matches
+ * @param source the string that pmatch applies to
+ * @param err Where an error message should be stored
+ * @return > 0 if expression evaluates to true, == 0 if false, < 0 on error
+ * @note err will be set to NULL on success, or to an error message on error
+ * @note nmatch/pmatch/source can be used both to make previous matches
+ *       available to ap_expr_exec_re and to use ap_expr_exec_re's matches
+ *       later on.
+ * @note request headers used during evaluation will be added to the Vary:
+ *       response header, unless ::AP_EXPR_FLAG_DONT_VARY is set.
+ *}
+//AP_DECLARE(int) ap_expr_exec_re(request_rec *r, const ap_expr_info_t *expr,
+//                                apr_size_t nmatch, ap_regmatch_t *pmatch,
+//                                const char **source, const char **err);
+function ap_expr_exec_re(r: Prequest_rec; const expr: Pap_expr_info_t;
+                         nmatch: apr_size_t; pmatch: Pap_regmatch_t;
+                         const source: PPChar; const err: PPChar): Integer;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name LibNamePrefix + 'ap_expr_exec_re' + LibSuff24;
+
+//** Context used during evaluation of a parse tree, created by ap_expr_exec */
+type
+  Pap_expr_eval_ctx_t = ^ap_expr_eval_ctx_t;
+  ap_expr_eval_ctx_t = record
+    //** the current request */
+    r : Prequest_rec;
+    //** the current connection */
+    c : Pconn_rec;
+    //** the current connection */
+    s : Pserver_rec;
+    //** the pool to use */
+    p : Papr_pool_t;
+    //** where to store the error string */
+    err : PPchar;
+    //** ap_expr_info_t for the expression */
+    info : Pap_expr_info_t;
+    //** regex match information for back references */
+    re_pmatch : Pap_regmatch_t;
+    //** size of the vector pointed to by re_pmatch */
+    re_nmatch : apr_size_t;
+    //** the string corresponding to the re_pmatch */
+    re_source : PPchar;
+    {** A string where the comma separated names of headers are stored
+     * to be later added to the Vary: header. If NULL, the caller is not
+     * interested in this information.
+     *}
+    vary_this : PPchar;
+    //** where to store the result string */
+    result_string : PPchar;
+    //** Arbitrary context data provided by the caller for custom functions */
+    data : pointer;
+    //** The current recursion level */
+    reclvl : Integer;
+  end; {ap_expr_eval_ctx_t}
+
+{**
+ * Evaluate a parse tree, full featured version
+ * @param ctx The evaluation context with all data filled in
+ * @return > 0 if expression evaluates to true, == 0 if false, < 0 on error
+ * @note *ctx->err will be set to NULL on success, or to an error message on
+ *       error
+ * @note request headers used during evaluation will be added to the Vary:
+ *       response header if ctx->vary_this is set.
+ *}
+//AP_DECLARE(int) ap_expr_exec_ctx(ap_expr_eval_ctx_t *ctx);
+function ap_expr_exec_ctx(ctx: Pap_expr_eval_ctx_t): Integer;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name LibNamePrefix + 'ap_expr_exec_ctx' + LibSuff4;
+
+{**
+ * Evaluate a parse tree of a string valued expression
+ * @param r The current request
+ * @param expr The expression to be evaluated
+ * @param err Where an error message should be stored
+ * @return The result string, NULL on error
+ * @note err will be set to NULL on success, or to an error message on error
+ * @note request headers used during evaluation will be added to the Vary:
+ *       response header, unless ::AP_EXPR_FLAG_DONT_VARY is set.
+ *}
+//AP_DECLARE(const char *) ap_expr_str_exec(request_rec *r,
+//                                          const ap_expr_info_t *expr,
+//                                          const char **err);
+function ap_expr_str_exec(r: Prequest_rec;
+                          const expr: Pap_expr_info_t;
+                          const err: PPChar): PChar;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name LibNamePrefix + 'ap_expr_str_exec' + LibSuff12;
+
+{**
+ * Evaluate a parse tree of a string valued expression
+ * @param r The current request
+ * @param expr The expression to be evaluated
+ * @param nmatch size of the regex match vector pmatch
+ * @param pmatch information about regex matches
+ * @param source the string that pmatch applies to
+ * @param err Where an error message should be stored
+ * @return The result string, NULL on error
+ * @note err will be set to NULL on success, or to an error message on error
+ * @note nmatch/pmatch/source can be used both to make previous matches
+ *       available to ap_expr_exec_re and to use ap_expr_exec_re's matches
+ *       later on.
+ * @note request headers used during evaluation will be added to the Vary:
+ *       response header, unless ::AP_EXPR_FLAG_DONT_VARY is set.
+ *}
+//AP_DECLARE(const char *) ap_expr_str_exec_re(request_rec *r,
+//                                             const ap_expr_info_t *expr,
+//                                             apr_size_t nmatch,
+//                                             ap_regmatch_t *pmatch,
+//                                             const char **source,
+//                                             const char **err);
+function ap_expr_str_exec_re(r: Prequest_rec;
+                          const expr: Pap_expr_info_t;
+                          nmatch: apr_size_t;
+                          pmatch: Pap_regmatch_t;
+                          const source: PPChar;
+                          const err: PPChar): PChar;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name LibNamePrefix + 'ap_expr_str_exec_re' + LibSuff24;
+
+
+{**
+ * The parser can be extended with variable lookup, functions, and
+ * and operators.
+ *
+ * During parsing, the parser calls the lookup function to resolve a
+ * name into a function pointer and an opaque context for the function.
+ * If the argument to a function or operator is constant, the lookup function
+ * may also parse that argument and store the parsed data in the context.
+ *
+ * The default lookup function is the hook ::ap_expr_lookup_default which just
+ * calls ap_run_expr_lookup. Modules can use it to make functions and
+ * variables generally available.
+ *
+ * An ap_expr consumer can also provide its own custom lookup function to
+ * modify the set of variables and functions that are available. The custom
+ * lookup function can in turn call 'ap_run_expr_lookup'.
+ *}
+
+{** Unary operator, takes one string argument and returns a bool value.
+ * The name must have the form '-z' (one letter only).
+ * @param ctx The evaluation context
+ * @param data An opaque context provided by the lookup hook function
+ * @param arg The (right) operand
+ * @return 0 or 1
+ *}
+//typedef int ap_expr_op_unary_t(ap_expr_eval_ctx_t *ctx, const void *data,
+//                               const char *arg);
+type
+  ap_expr_op_unary_t = function(ctx: Pap_expr_eval_ctx_t; const data: Pointer;
+                                const arg: PChar): Integer; cdecl;
+
+{** Binary operator, takes two string arguments and returns a bool value.
+ * The name must have the form '-cmp' (at least two letters).
+ * @param ctx The evaluation context
+ * @param data An opaque context provided by the lookup hook function
+ * @param arg1 The left operand
+ * @param arg2 The right operand
+ * @return 0 or 1
+ *}
+//typedef int ap_expr_op_binary_t(ap_expr_eval_ctx_t *ctx, const void *data,
+//                                const char *arg1, const char *arg2);
+  ap_expr_op_binary_t = function(ctx: Pap_expr_eval_ctx_t; const data: Pointer;
+                                 const arg1: PChar; const arg2: PChar): Integer; cdecl;
+
+{** String valued function, takes a string argument and returns a string
+ * @param ctx The evaluation context
+ * @param data An opaque context provided by the lookup hook function
+ * @param arg The argument
+ * @return The functions result string, may be NULL for 'empty string'
+ *}
+//typedef const char *(ap_expr_string_func_t)(ap_expr_eval_ctx_t *ctx,
+//                                            const void *data,
+//                                            const char *arg);
+  ap_expr_string_func_t = function(ctx: Pap_expr_eval_ctx_t;
+                                   const data: Pointer;
+                                   const arg: PChar): PChar; cdecl;
+
+{** List valued function, takes a string argument and returns a list of strings
+ * Can currently only be called following the builtin '-in' operator.
+ * @param ctx The evaluation context
+ * @param data An opaque context provided by the lookup hook function
+ * @param arg The argument
+ * @return The functions result list of strings, may be NULL for 'empty array'
+ *}
+//typedef apr_array_header_t *(ap_expr_list_func_t)(ap_expr_eval_ctx_t *ctx,
+//                                                  const void *data,
+//                                                  const char *arg);
+  ap_expr_list_func_t = function(ctx: Pap_expr_eval_ctx_t;
+                                 const data: Pointer;
+                                 const arg: PChar): Papr_array_header_t;
+
+{** Variable lookup function, takes no argument and returns a string
+ * @param ctx The evaluation context
+ * @param data An opaque context provided by the lookup hook function
+ * @return The expanded variable
+ *}
+//typedef const char *(ap_expr_var_func_t)(ap_expr_eval_ctx_t *ctx,
+//                                         const void *data);
+  ap_expr_var_func_t = function(ctx: Pap_expr_eval_ctx_t;
+                                const data: Pointer): PChar; cdecl;
+
+const
+  AP_EXPR_FUNC_VAR        = 0;
+  AP_EXPR_FUNC_STRING     = 1;
+  AP_EXPR_FUNC_LIST       = 2;
+  AP_EXPR_FUNC_OP_UNARY   = 3;
+  AP_EXPR_FUNC_OP_BINARY  = 4;
+
+//** parameter struct passed to the lookup hook functions */
+type
+  Pap_expr_lookup_parms = ^ap_expr_lookup_parms;
+  ap_expr_lookup_parms = record
+    //** type of the looked up object */
+    type_: Integer;
+//#define AP_EXPR_FUNC_VAR        0   {fpc -> consts are moved up}
+//#define AP_EXPR_FUNC_STRING     1
+//#define AP_EXPR_FUNC_LIST       2
+//#define AP_EXPR_FUNC_OP_UNARY   3
+//#define AP_EXPR_FUNC_OP_BINARY  4
+    //** name of the looked up object */
+    name: PChar;
+
+    flags: Integer;
+
+    pool: Papr_pool_t;
+    ptemp: Papr_pool_t;
+
+    //** where to store the function pointer */
+    func: PPointer;
+    //** where to store the function's context */
+    data: PPointer;
+    //** where to store the error message (if any) */
+    err: PPChar;
+
+    {** arg for pre-parsing (only if a simple string).
+     *  For binary ops, this is the right argument. *}
+    arg: PChar;
+  end; {ap_expr_lookup_parms}
+
+{** Function for looking up the provider function for a variable, operator
+ *  or function in an expression.
+ *  @param parms The parameter struct, also determins where the result is
+ *               stored.
+ *  @return OK on success,
+ *          !OK on failure,
+ *          DECLINED if the requested name is not handled by this function
+ *}
+//typedef int (ap_expr_lookup_fn_t)(ap_expr_lookup_parms *parms);
+type
+  ap_expr_lookup_fn_t = function(parms: ap_expr_lookup_parms): Integer; cdecl;
+
+{** Default lookup function which just calls ap_run_expr_lookup().
+ *  ap_run_expr_lookup cannot be used directly because it has the wrong
+ *  calling convention under Windows.
+ *}
+//AP_DECLARE_NONSTD(int) ap_expr_lookup_default(ap_expr_lookup_parms *parms);
+function ap_expr_lookup_default(parms: Pap_expr_lookup_parms): Integer; cdecl;
+  external LibHTTPD name LibNamePrefix + 'ap_expr_lookup_default';
+
+//AP_DECLARE_HOOK(int, expr_lookup, (ap_expr_lookup_parms *parms))
+{macro ignored for now}
+
+{**
+ * Parse an expression into a parse tree
+ * @param pool Pool
+ * @param ptemp temp pool
+ * @param info The ap_expr_info_t struct (with values filled in)
+ * @param expr The expression string to parse
+ * @param lookup_fn The lookup function to use, NULL for default
+ * @return NULL on success, error message on error.
+ *         A pointer to the resulting parse tree will be stored in
+ *         info->root_node.
+ *}
+//AP_DECLARE(const char *) ap_expr_parse(apr_pool_t *pool, apr_pool_t *ptemp,
+//                                       ap_expr_info_t *info, const char *expr,
+//                                       ap_expr_lookup_fn_t *lookup_fn);
+function ap_expr_parse(pool, ptemp: Papr_pool_t;
+                       info: Pap_expr_info_t;
+                       const expr: PChar;
+                       lookup_fn: ap_expr_lookup_fn_t): PChar;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name LibNamePrefix + 'ap_expr_parse' + LibSuff20;
+
+{**
+ * High level interface to ap_expr_parse that also creates ap_expr_info_t and
+ * uses info from cmd_parms to fill in most of it.
+ * @param cmd The cmd_parms struct
+ * @param expr The expression string to parse
+ * @param flags The flags to use, see AP_EXPR_FLAG_*
+ * @param err Set to NULL on success, error message on error
+ * @param lookup_fn The lookup function used to lookup vars, functions, and
+ *        operators
+ * @param module_index The module_index to set for the expression
+ * @return The parsed expression
+ * @note Usually ap_expr_parse_cmd() should be used
+ *}
+//AP_DECLARE(ap_expr_info_t *) ap_expr_parse_cmd_mi(const cmd_parms *cmd,
+//                                                  const char *expr,
+//                                                  unsigned int flags,
+//                                                  const char **err,
+//                                                  ap_expr_lookup_fn_t *lookup_fn,
+//                                                  int module_index);
+function ap_expr_parse_cmd_mi(cmd: Pcmd_parms;
+                              const expr: PChar;
+                              flags: cuint;
+                              const err: PPChar;
+                              lookup_fn: ap_expr_lookup_fn_t;
+                              module_index: Integer): PChar;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name LibNamePrefix + 'ap_expr_parse_cmd_mi' + LibSuff24;
+
+{**
+ * Convenience wrapper for ap_expr_parse_cmd_mi() that sets
+ * module_index = APLOG_MODULE_INDEX
+ *}
+//#define ap_expr_parse_cmd(cmd, expr, flags, err, lookup_fn) \
+//        ap_expr_parse_cmd_mi(cmd, expr, flags, err, lookup_fn, APLOG_MODULE_INDEX)
+
+ {**
+  * Internal initialisation of ap_expr (for httpd internal use)
+  *}
+//void ap_expr_init(apr_pool_t *pool);
+
+//#endif /* AP_EXPR_H */
+//** @} */

+ 438 - 0
packages/httpd24/src/ap_mmn.inc

@@ -0,0 +1,438 @@
+(* 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.
+ *)
+
+(**
+ * @file  ap_mmn.h
+ * @brief Module Magic Number
+ *
+ * @defgroup APACHE_CORE_MMN Module Magic Number
+ * @ingroup  APACHE_CORE
+ * @{
+ *)
+
+//#ifndef APACHE_AP_MMN_H
+//#define APACHE_AP_MMN_H
+
+{*
+ * MODULE_MAGIC_NUMBER_MAJOR
+ * Major API changes that could cause compatibility problems for older modules
+ * such as structure size changes.  No binary compatibility is possible across
+ * a change in the major version.
+ *
+ * MODULE_MAGIC_NUMBER_MINOR
+ * Minor API changes that do not cause binary compatibility problems.
+ * Should be reset to 0 when upgrading MODULE_MAGIC_NUMBER_MAJOR.
+ *
+ * See the AP_MODULE_MAGIC_AT_LEAST macro below for an example.
+ *}
+
+(*
+ * 20010224   (2.0.13-dev) MODULE_MAGIC_COOKIE reset to "AP20"
+ * 20010523   (2.0.19-dev) bump for scoreboard structure reordering
+ * 20010627   (2.0.19-dev) more API changes than I can count
+ * 20010726   (2.0.22-dev) more big API changes
+ * 20010808   (2.0.23-dev) dir d_is_absolute bit introduced, bucket changes, etc
+ * 20010825   (2.0.25-dev) removed d_is_absolute, introduced map_to_storage hook
+ * 20011002   (2.0.26-dev) removed 1.3-deprecated request_rec.content_language
+ * 20011127   (2.0.29-dev) bump for postconfig hook change, and removal of
+ *                         socket from connection record
+ * 20011212   (2.0.30-dev) bump for new used_path_info member of request_rec
+ * 20011218   (2.0.30-dev) bump for new sbh member of conn_rec, different
+ *                         declarations for scoreboard, new parameter to
+ *                         create_connection hook
+ * 20020102   (2.0.30-dev) bump for changed type of limit_req_body in
+ *                         core_dir_config
+ * 20020109   (2.0.31-dev) bump for changed shm and scoreboard declarations
+ * 20020111   (2.0.31-dev) bump for ETag fields added at end of cor_dir_config
+ * 20020114   (2.0.31-dev) mod_dav changed how it asks its provider to fulfill
+ *                         a GET request
+ * 20020118   (2.0.31-dev) Input filtering split of blocking and mode
+ * 20020127   (2.0.31-dev) bump for pre_mpm hook change
+ * 20020128   (2.0.31-dev) bump for pre_config hook change
+ * 20020218   (2.0.33-dev) bump for AddOutputFilterByType directive
+ * 20020220   (2.0.33-dev) bump for scoreboard.h structure change
+ * 20020302   (2.0.33-dev) bump for protocol_filter additions.
+ * 20020306   (2.0.34-dev) bump for filter type renames.
+ * 20020318   (2.0.34-dev) mod_dav's API for REPORT generation changed
+ * 20020319   (2.0.34-dev) M_INVALID changed, plus new M_* methods for RFC 3253
+ * 20020327   (2.0.35-dev) Add parameter to quick_handler hook
+ * 20020329   (2.0.35-dev) bump for addition of freelists to bucket API
+ * 20020329.1 (2.0.36)     minor bump for new arg to opt fn ap_cgi_build_command
+ * 20020506   (2.0.37-dev) Removed r->boundary in request_rec.
+ * 20020529   (2.0.37-dev) Standardized the names of some apr_pool_*_set funcs
+ * 20020602   (2.0.37-dev) Bucket API change (metadata buckets)
+ * 20020612   (2.0.38-dev) Changed server_rec->[keep_alive_]timeout to apr time
+ * 20020625   (2.0.40-dev) Changed conn_rec->keepalive to an enumeration
+ * 20020628   (2.0.40-dev) Added filter_init to filter registration functions
+ * 20020903   (2.0.41-dev) APR's error constants changed
+ * 20020903.1 (2.1.0-dev)  allow_encoded_slashes added to core_dir_config
+ * 20020903.2 (2.0.46-dev) add ap_escape_logitem
+ * 20030213.1 (2.1.0-dev)  changed log_writer optional fn's to return previous
+ *                         handler
+ * 20030821   (2.1.0-dev)  bumped mod_include's entire API
+ * 20030821.1 (2.1.0-dev)  added XHTML doctypes
+ * 20030821.2 (2.1.0-dev)  added ap_escape_errorlog_item
+ * 20030821.3 (2.1.0-dev)  added ap_get_server_revision / ap_version_t
+ * 20040425   (2.1.0-dev)  removed ap_add_named_module API
+ *                         changed ap_add_module, ap_add_loaded_module,
+ *                         ap_setup_prelinked_modules,
+ *                         ap_process_resource_config
+ * 20040425.1 (2.1.0-dev)  Added ap_module_symbol_t and
+ *                         ap_prelinked_module_symbols
+ * 20050101.0 (2.1.2-dev)  Axed misnamed http_method for http_scheme
+ *                         (which it was!)
+ * 20050127.0 (2.1.3-dev)  renamed regex_t->ap_regex_t,
+ *                         regmatch_t->ap_regmatch_t, REG_*->AP_REG_*,
+ *                         removed reg* in place of ap_reg*; added ap_regex.h
+ * 20050217.0 (2.1.3-dev)  Axed find_child_by_pid, mpm_*_completion_context
+ *                         (winnt mpm) symbols from the public sector, and
+ *                         decorated real_exit_code with ap_ in the win32/os.h.
+ * 20050305.0 (2.1.4-dev)  added pid and generation fields to worker_score
+ * 20050305.1 (2.1.5-dev)  added ap_vhost_iterate_given_conn.
+ * 20050305.2 (2.1.5-dev)  added AP_INIT_TAKE_ARGV.
+ * 20050305.3 (2.1.5-dev)  added Protocol Framework.
+ * 20050701.0 (2.1.7-dev)  Bump MODULE_MAGIC_COOKIE to "AP21"!
+ * 20050701.1 (2.1.7-dev)  trace_enable member added to core server_config
+ * 20050708.0 (2.1.7-dev)  Bump MODULE_MAGIC_COOKIE to "AP22"!
+ * 20050708.1 (2.1.7-dev)  add proxy request_status hook (minor)
+ * 20050919.0 (2.1.8-dev)  mod_ssl ssl_ext_list optional function added
+ * 20051005.0 (2.1.8-dev)  NET_TIME filter eliminated
+ * 20051005.0 (2.3.0-dev)  Bump MODULE_MAGIC_COOKIE to "AP24"!
+ * 20051115.0 (2.3.0-dev)  Added use_canonical_phys_port to core_dir_config
+ * 20060110.0 (2.3.0-dev)  Conversion of Authz to be provider based
+ *                         addition of <SatisfyAll><SatisfyOne>
+ *                         removal of Satisfy, Allow, Deny, Order
+ * 20060110.1 (2.3.0-dev)  minex and minex_set members added to
+ *                         cache_server_conf (minor)
+ * 20060110.2 (2.3.0-dev)  flush_packets and flush_wait members added to
+ *                         proxy_server (minor)
+ * 20060110.3 (2.3.0-dev)  added inreslist member to proxy_conn_rec (minor)
+ * 20060110.4 (2.3.0-dev)  Added server_scheme member to server_rec (minor)
+ * 20060905.0 (2.3.0-dev)  Replaced ap_get_server_version() with
+ *                         ap_get_server_banner() and ap_get_server_description()
+ * 20060905.1 (2.3.0-dev)  Enable retry=0 for the worker (minor)
+ * 20060905.2 (2.3.0-dev)  Added ap_all_available_mutexes_string,
+ *                         ap_available_mutexes_string and
+ *                         ap_parse_mutex()
+ * 20060905.3 (2.3.0-dev)  Added conn_rec::clogging_input_filters.
+ * 20060905.4 (2.3.0-dev)  Added proxy_balancer::sticky_path.
+ * 20060905.5 (2.3.0-dev)  Added ap_mpm_safe_kill()
+ * 20070823.0 (2.3.0-dev)  Removed ap_all_available_mutexes_string,
+ *                         ap_available_mutexes_string for macros
+ * 20070823.1 (2.3.0-dev)  add ap_send_interim_response()
+ * 20071023.0 (2.3.0-dev)  add ap_get_scoreboard(sbh) split from the less
+ *                         conventional ap_get_scoreboard(proc, thread)
+ * 20071023.1 (2.3.0-dev)  Add flags field to struct proxy_alias
+ * 20071023.2 (2.3.0-dev)  Add ap_mod_status_reqtail
+ * 20071023.3 (2.3.0-dev)  Declare ap_time_process_request() as part of the
+ *                         public scoreboard API.
+ * 20071108.1 (2.3.0-dev)  Add the optional kept_body brigade to request_rec
+ * 20071108.2 (2.3.0-dev)  Add st and keep fields to struct util_ldap_connection_t
+ * 20071108.3 (2.3.0-dev)  Add API guarantee for adding connection filters
+ *                         with non-NULL request_rec pointer (ap_add_*_filter* )
+ * 20071108.4 (2.3.0-dev)  Add ap_proxy_ssl_connection_cleanup
+ * 20071108.5 (2.3.0-dev)  Add *scpool to proxy_conn_rec structure
+ * 20071108.6 (2.3.0-dev)  Add *r and need_flush to proxy_conn_rec structure
+ * 20071108.7 (2.3.0-dev)  Add *ftp_directory_charset to proxy_dir_conf
+ * 20071108.8 (2.3.0-dev)  Add optional function ap_logio_add_bytes_in() to mog_logio
+ * 20071108.9 (2.3.0-dev)  Add chroot support to unixd_config
+ * 20071108.10(2.3.0-dev)  Introduce new ap_expr API
+ * 20071108.11(2.3.0-dev)  Revise/Expand new ap_expr API
+ * 20071108.12(2.3.0-dev)  Remove ap_expr_clone from the API (same day it was added)
+ * 20080403.0 (2.3.0-dev)  Add condition field to core dir config
+ * 20080403.1 (2.3.0-dev)  Add authn/z hook and provider registration wrappers.
+ * 20080403.2 (2.3.0-dev)  Add ap_escape_path_segment_buffer() and ap_unescape_all().
+ * 20080407.0 (2.3.0-dev)  Remove ap_graceful_stop_signalled.
+ * 20080407.1              Deprecate ap_cache_cacheable_hdrs_out and add two
+ *                         generalized ap_cache_cacheable_headers_(in|out).
+ * 20080528.0 (2.3.0-dev)  Switch order of ftp_directory_charset and
+ *                         interpolate_env in proxy_dir_conf.
+ *                         Rationale: see r661069.
+ * 20080528.1 (2.3.0-dev)  add has_realm_hash() to authn_provider struct
+ * 20080722.0 (2.3.0-dev)  remove has_realm_hash() from authn_provider struct
+ * 20080722.1 (2.3.0-dev)  Add conn_timeout and conn_timeout_set to
+ *                         proxy_worker struct.
+ * 20080722.2 (2.3.0-dev)  Add scolonsep to proxy_balancer
+ * 20080829.0 (2.3.0-dev)  Add cookie attributes when removing cookies
+ * 20080830.0 (2.3.0-dev)  Cookies can be set on headers_out and err_headers_out
+ * 20080920.0 (2.3.0-dev)  Add ap_mpm_register_timed_callback.
+ * 20080920.1 (2.3.0-dev)  Export mod_rewrite.h in the public API.
+ * 20080920.2 (2.3.0-dev)  Added ap_timeout_parameter_parse to util.c / httpd.h
+ * 20081101.0 (2.3.0-dev)  Remove unused AUTHZ_GROUP_NOTE define.
+ * 20081102.0 (2.3.0-dev)  Remove authz_provider_list, authz_request_state,
+ *                         and AUTHZ_ACCESS_PASSED_NOTE.
+ * 20081104.0 (2.3.0-dev)  Remove r and need_flush fields from proxy_conn_rec
+ *                         as they are no longer used and add
+ *                         ap_proxy_buckets_lifetime_transform to mod_proxy.h
+ * 20081129.0 (2.3.0-dev)  Move AP_FILTER_ERROR and AP_NOBODY_READ|WROTE
+ *                         from util_filter.h to httpd.h and change their
+ *                         numeric values so they do not overlap with other
+ *                         potential status codes
+ * 20081201.0 (2.3.0-dev)  Rename several APIs to include ap_ prefix.
+ * 20081201.1 (2.3.0-dev)  Added ap_args_to_table and ap_body_to_table.
+ * 20081212.0 (2.3.0-dev)  Remove sb_type from process_score in scoreboard.h.
+ * 20081231.0 (2.3.0-dev)  Switch ap_escape_html API: add ap_escape_html2,
+ *                         and make ap_escape_html a macro for it.
+ * 20090130.0 (2.3.2-dev)  Add ap_ prefix to unixd_setup_child().
+ * 20090131.0 (2.3.2-dev)  Remove ap_default_type(), disable DefaultType
+ * 20090208.0 (2.3.2-dev)  Add conn_rec::current_thread.
+ * 20090208.1 (2.3.3-dev)  Add ap_retained_data_create()/ap_retained_data_get()
+ * 20090401.0 (2.3.3-dev)  Remove ap_threads_per_child, ap_max_daemons_limit,
+ *                         ap_my_generation, etc.  ap_mpm_query() can't be called
+ *                         until after the register-hooks phase.
+ * 20090401.1 (2.3.3-dev)  Protected log.c internals, http_log.h changes
+ * 20090401.2 (2.3.3-dev)  Added tmp_flush_bb to core_output_filter_ctx_t
+ * 20090401.3 (2.3.3-dev)  Added DAV options provider to mod_dav.h
+ * 20090925.0 (2.3.3-dev)  Added server_rec::context and added *server_rec
+ *                         param to ap_wait_or_timeout()
+ * 20090925.1 (2.3.3-dev)  Add optional function ap_logio_get_last_bytes() to
+ *                         mod_logio
+ * 20091011.0 (2.3.3-dev)  Move preserve_host{,_set} from proxy_server_conf to
+ *                         proxy_dir_conf
+ * 20091011.1 (2.3.3-dev)  add debug_level to util_ldap_state_t
+ * 20091031.0 (2.3.3-dev)  remove public LDAP referral-related macros
+ * 20091119.0 (2.3.4-dev)  dav_error interface uses apr_status_t parm, not errno
+ * 20091119.1 (2.3.4-dev)  ap_mutex_register(), ap_{proc,global}_mutex_create()
+ * 20091229.0 (2.3.5-dev)  Move allowed_connect_ports from proxy_server_conf
+ *                         to mod_proxy_connect
+ * 20091230.0 (2.3.5-dev)  Move ftp_directory_charset from proxy_dir_conf
+ *                         to proxy_ftp_dir_conf(mod_proxy_ftp)
+ * 20091230.1 (2.3.5-dev)  add util_ldap_state_t.opTimeout
+ * 20091230.2 (2.3.5-dev)  add ap_get_server_name_for_url()
+ * 20091230.3 (2.3.6-dev)  add ap_parse_log_level()
+ * 20091230.4 (2.3.6-dev)  export ap_process_request_after_handler() for mod_serf
+ * 20100208.0 (2.3.6-dev)  ap_socache_provider_t API changes to store and iterate
+ * 20100208.1 (2.3.6-dev)  Added forward member to proxy_conn_rec
+ * 20100208.2 (2.3.6-dev)  Added ap_log_command_line().
+ * 20100223.0 (2.3.6-dev)  LDAP client_certs per-server moved to per-dir
+ * 20100223.1 (2.3.6-dev)  Added ap_process_fnmatch_configs().
+ * 20100504.0 (2.3.6-dev)  Added name arg to ap_{proc,global}_mutex_create().
+ * 20100604.0 (2.3.6-dev)  Remove unused core_dir_config::loglevel
+ * 20100606.0 (2.3.6-dev)  Make ap_log_*error macro wrappers around
+ *                         ap_log_*error_ to save argument preparation and
+ *                         function call overhead.
+ *                         Introduce per-module loglevels, including new APIs
+ *                         APLOG_USE_MODULE() and AP_DECLARE_MODULE().
+ * 20100606.1 (2.3.6-dev)  Added extended timestamp formatting via
+ *                         ap_recent_ctime_ex().
+ * 20100609.0 (2.3.6-dev)  Dropped ap_body_to_table due to missing constraints.
+ * 20100609.1 (2.3.7-dev)  Introduce ap_log_cserror()
+ * 20100609.2 (2.3.7-dev)  Add deferred write pool to core_output_filter_ctx
+ * 20100625.0 (2.3.7-dev)  Add 'userctx' to socache iterator callback prototype
+ * 20100630.0 (2.3.7-dev)  make module_levels vector of char instead of int
+ * 20100701.0 (2.3.7-dev)  re-order struct members to improve alignment
+ * 20100701.1 (2.3.7-dev)  add note_auth_failure hook
+ * 20100701.2 (2.3.7-dev)  add ap_proxy_*_wid() functions
+ * 20100714.0 (2.3.7-dev)  add access_checker_ex hook, add AUTHZ_DENIED_NO_USER
+ *                         to authz_status, call authz providers twice to allow
+ *                         authz without authenticated user
+ * 20100719.0 (2.3.7-dev)  Add symbol name parameter to ap_add_module and
+ *                         ap_add_loaded_module. Add ap_find_module_short_name
+ * 20100723.0 (2.3.7-dev)  Remove ct_output_filters from core rec
+ * 20100723.1 (2.3.7-dev)  Added ap_proxy_hashfunc() and hash elements to
+ *                         proxy worker structs
+ * 20100723.2 (2.3.7-dev)  Add ap_request_has_body()
+ * 20100723.3 (2.3.8-dev)  Add ap_check_mpm()
+ * 20100905.0 (2.3.9-dev)  Add log_id to conn and req recs. Add error log
+ *                         format handlers. Support AP_CTIME_OPTION_COMPACT in
+ *                         ap_recent_ctime_ex().
+ * 20100905.1 (2.3.9-dev)  Add ap_cache_check_allowed()
+ * 20100912.0 (2.3.9-dev)  Add an additional "out" brigade parameter to the
+ *                         mod_cache store_body() provider function.
+ * 20100916.0 (2.3.9-dev)  Add commit_entity() to the mod_cache provider
+ *                         interface.
+ * 20100918.0 (2.3.9-dev)  Move the request_rec within mod_include to be
+ *                         exposed within include_ctx_t.
+ * 20100919.0 (2.3.9-dev)  Authz providers: Add parsed_require_line parameter
+ *                         to check_authorization() function. Add
+ *                         parse_require_line() function.
+ * 20100919.1 (2.3.9-dev)  Introduce ap_rxplus util/API
+ * 20100921.0 (2.3.9-dev)  Add an apr_bucket_brigade to the create_entity
+ *                         provider interface for mod_cache.h.
+ * 20100922.0 (2.3.9-dev)  Move cache_* functions from mod_cache.h to a
+ *                         private header file.
+ * 20100923.0 (2.3.9-dev)  Remove MOD_CACHE_REQUEST_REC, remove deprecated
+ *                         ap_cache_cacheable_hdrs_out, trim cache_object_t,
+ *                         make ap_cache_accept_headers, ap_cache_accept_headers
+ *                         ap_cache_try_lock, ap_cache_check_freshness,
+ *                         cache_server_conf, cache_enable, cache_disable,
+ *                         cache_request_rec and cache_provider_list private.
+ * 20100923.1 (2.3.9-dev)  Add cache_status hook.
+ * 20100923.2 (2.3.9-dev)  Add generate_log_id hook.
+ *                         Make root parameter of ap_expr_eval() const.
+ * 20100923.3 (2.3.9-dev)  Add "last" member to ap_directive_t
+ * 20101012.0 (2.3.9-dev)  Add header to cache_status hook.
+ * 20101016.0 (2.3.9-dev)  Remove ap_cache_check_allowed().
+ * 20101017.0 (2.3.9-dev)  Make ap_cache_control() public, add cache_control_t
+ *                         to mod_disk_cache format.
+ * 20101106.0 (2.3.9-dev)  Replace the ap_expr parser derived from
+ *                         mod_include's parser with one derived from
+ *                         mod_ssl's parser. Clean up ap_expr's public
+ *                         interface.
+ * 20101106.1 (2.3.9-dev)  Add ap_pool_cleanup_set_null() generic cleanup
+ * 20101106.2 (2.3.9-dev)  Add suexec_disabled_reason field to ap_unixd_config
+ * 20101113.0 (2.3.9-dev)  Add source address to mod_proxy.h
+ * 20101113.1 (2.3.9-dev)  Add ap_set_flag_slot_char()
+ * 20101113.2 (2.3.9-dev)  Add ap_expr_exec_re()
+ * 20101204.0 (2.3.10-dev) Add _t to ap_expr's typedef names
+ * 20101223.0 (2.3.11-dev) Remove cleaned from proxy_conn_rec.
+ * 20101223.1 (2.3.11-dev) Rework mod_proxy, et.al. Remove proxy_worker_stat
+ *                         and replace w/ proxy_worker_shared; remove worker
+ *                         info from scoreboard and use slotmem; Allow
+ *                         dynamic growth of balancer members; Remove
+ *                         BalancerNonce in favor of 'nonce' parameter.
+ * 20110117.0 (2.3.11-dev) Merge <If> sections in separate step (ap_if_walk).
+ *                         Add core_dir_config->sec_if. Add ap_add_if_conf().
+ *                         Add pool argument to ap_add_file_conf().
+ * 20110117.1 (2.3.11-dev) Add ap_pstr2_alnum() and ap_str2_alnum()
+ * 20110203.0 (2.3.11-dev) Raise DYNAMIC_MODULE_LIMIT to 256
+ * 20110203.1 (2.3.11-dev) Add ap_state_query()
+ * 20110203.2 (2.3.11-dev) Add ap_run_pre_read_request() hook and
+ *                         ap_parse_form_data() util
+ * 20110312.0 (2.3.12-dev) remove uldap_connection_cleanup and add
+                           util_ldap_state_t.connectionPoolTTL,
+                           util_ldap_connection_t.freed, and
+                           util_ldap_connection_t.rebind_pool.
+ * 20110312.1 (2.3.12-dev) Add core_dir_config.decode_encoded_slashes.
+ * 20110328.0 (2.3.12-dev) change type and name of connectionPoolTTL in util_ldap_state_t
+                           connectionPoolTTL (connection_pool_ttl, int->apr_interval_t)
+ * 20110329.0 (2.3.12-dev) Change single-bit signed fields to unsigned in
+ *                         proxy and cache interfaces.
+ *                         Change ap_configfile_t/ap_cfg_getline()/
+ *                         ap_cfg_getc() API, add ap_pcfg_strerror()
+ *                         Axe mpm_note_child_killed hook, change
+ *                         ap_reclaim_child_process and ap_recover_child_process
+ *                         interfaces.
+ * 20110329.1 (2.3.12-dev) Add ap_reserve_module_slots()/ap_reserve_module_slots_directive()
+ *                         change AP_CORE_DECLARE to AP_DECLARE: ap_create_request_config()
+ *                         change AP_DECLARE to AP_CORE_DECLARE: ap_register_log_hooks()
+ * 20110329.2 (2.3.12-dev) Add child_status and end_generation hooks.
+ * 20110329.3 (2.3.12-dev) Add format field to ap_errorlog_info.
+ * 20110329.4 (2.3.13-dev) bgrowth and max_balancers to proxy_server_conf.
+ * 20110329.5 (2.3.13-dev) Add ap_regexec_len()
+ * 20110329.6 (2.3.13-dev) Add AP_EXPR_FLAGS_RESTRICTED, ap_expr_eval_ctx_t->data,
+ *                         ap_expr_exec_ctx()
+ * 20110604.0 (2.3.13-dev) Make ap_rputs() inline
+ * 20110605.0 (2.3.13-dev) add core_dir_config->condition_ifelse, change return
+ *                         type of ap_add_if_conf().
+ *                         Add members of core_request_config: document_root,
+ *                         context_document_root, context_prefix.
+ *                         Add ap_context_*(), ap_set_context_info(), ap_set_document_root()
+ * 20110605.1 (2.3.13-dev) add ap_(get|set)_core_module_config()
+ * 20110605.2 (2.3.13-dev) add ap_get_conn_socket()
+ * 20110619.0 (2.3.13-dev) add async connection infos to process_score in scoreboard,
+ *                         add ap_start_lingering_close(),
+ *                         add conn_state_e:CONN_STATE_LINGER_NORMAL and CONN_STATE_LINGER_SHORT
+ * 20110619.1 (2.3.13-dev) add ap_str_toupper()
+ * 20110702.0 (2.3.14-dev) make ap_expr_parse_cmd() macro wrapper for new
+ *                         ap_expr_parse_cmd_mi() function, add ap_expr_str_*() functions,
+ *                         rename AP_EXPR_FLAGS_* -> AP_EXPR_FLAG_*
+ * 20110702.1 (2.3.14-dev) Add ap_scan_script_header_err*_ex functions
+ * 20110723.0 (2.3.14-dev) Revert addition of ap_ldap*
+ * 20110724.0 (2.3.14-dev) Add override_list as parameter to ap_parse_htaccess
+ *                         Add member override_list to cmd_parms_struct,
+ *                         core_dir_config and htaccess_result
+ * 20110724.1 (2.3.15-dev) add NOT_IN_HTACCESS
+ * 20110724.2 (2.3.15-dev) retries and retry_delay in util_ldap_state_t
+ * 20110724.3 (2.3.15-dev) add util_varbuf.h / ap_varbuf API
+ * 20110724.4 (2.3.15-dev) add max_ranges to core_dir_config
+ * 20110724.5 (2.3.15-dev) add ap_set_accept_ranges()
+ * 20110724.6 (2.3.15-dev) add max_overlaps and max_reversals to core_dir_config
+ * 20110724.7 (2.3.15-dev) add ap_random_insecure_bytes(), ap_random_pick()
+ * 20110724.8 (2.3.15-dev) add ap_abort_on_oom(), ap_malloc(), ap_calloc(),
+ *                         ap_realloc()
+ * 20110724.9 (2.3.15-dev) add ap_varbuf_pdup() and ap_varbuf_regsub()
+ * 20110724.10(2.3.15-dev) Export ap_max_mem_free
+ * 20111009.0 (2.3.15-dev) Remove ap_proxy_removestr(),
+ *                         add ap_unixd_config.group_name
+ * 20111014.0 (2.3.15-dev) Remove cookie_path_str and cookie_domain_str from
+ *                         proxy_dir_conf
+ * 20111025.0 (2.3.15-dev) Add return value and maxlen to ap_varbuf_regsub(),
+ *                         add ap_pregsub_ex()
+ * 20111025.1 (2.3.15-dev) Add ap_escape_urlencoded(), ap_escape_urlencoded_buffer()
+ *                         and ap_unescape_urlencoded().
+ * 20111025.2 (2.3.15-dev) Add ap_lua_ssl_val to mod_lua
+ * 20111025.3 (2.4.0-dev)  Add reclvl to ap_expr_eval_ctx_t
+ * 20111122.0 (2.4.0-dev)  Remove parts of conn_state_t that are private to the MPM
+ * 20111123.0 (2.4.0-dev)  Pass ap_errorlog_info struct to error_log hook,
+ *                         add pool to ap_errorlog_info.
+ * 20111130.0 (2.4.0-dev)  c->remote_ip becomes c->peer_ip and r->client_ip,
+ *                         c->remote_addr becomes c->peer_addr and r->client_addr
+ * 20111201.0 (2.4.0-dev)  Add invalidate_entity() to the cache provider.
+ * 20111202.0 (2.4.0-dev)  Use apr_status_t across mod_session API.
+ * 20111202.1 (2.4.0-dev)  add APLOGNO()
+ * 20111203.0 (2.4.0-dev)  Optional ap_proxy_retry_worker(), remove
+ *                         ap_proxy_string_read(), ap_cache_liststr(),
+ *                         ap_proxy_buckets_lifetime_transform(),
+ *                         ap_proxy_date_canon(), ap_proxy_is_ipaddr(),
+ *                         ap_proxy_is_domainname(), ap_proxy_is_hostname(),
+ *                         ap_proxy_is_word(), ap_proxy_hex2sec(),
+ *                         ap_proxy_sec2hex(), ap_proxy_make_fake_req(),
+ *                         ap_proxy_strmatch_path, ap_proxy_strmatch_domain,
+ *                         ap_proxy_table_unmerge(), proxy_lb_workers.
+ * 20120109.0 (2.4.1-dev)  Changes sizeof(overrides_t) in core config.
+ * 20120109.1 (2.4.1-dev)  remove sb_type in global_score.
+ * 20120109.2 (2.4.1-dev)  Make core_output_filter_ctx_t and core_ctx_t
+ *                         private;
+ *                         move core_net rec definition to http_core.h;
+ *                         add insert_network_bucket hook, AP_DECLINED
+ * 20120211.0 (2.4.1-dev)  Change re_nsub in ap_regex_t from apr_size_t to int.
+ * 20120211.1 (2.4.2-dev)  Add AP_HAVE_C99
+ * 20120211.2 (2.4.2-dev)  Add ap_runtime_dir_relative
+ * 20120211.3 (2.4.2-dev)  Add forcerecovery to proxy_balancer_shared struct
+ * 20120211.4 (2.4.3-dev)  Add ap_list_provider_groups()
+ * 20120211.5 (2.4.3-dev)  Add missing HTTP status codes registered with IANA.
+ * 20120211.6 (2.4.3-dev)  Add ap_proxy_checkproxyblock2.
+ *)
+
+const
+  MODULE_MAGIC_COOKIE       = $41503234; {* "AP24" *}
+
+  MODULE_MAGIC_NUMBER_MAJOR = 20120211;
+
+  MODULE_MAGIC_NUMBER_MINOR = 6;         {* 0...n *}
+
+{**
+ * Determine if the server's current MODULE_MAGIC_NUMBER is at least a
+ * specified value.
+ *
+ * Useful for testing for features.
+ * For example, suppose you wish to use the apr_table_overlap
+ *    function.  You can do this:
+ *
+ * \code
+ * #if AP_MODULE_MAGIC_AT_LEAST(19980812,2)
+ *     ... use apr_table_overlap()
+ * #else
+ *     ... alternative code which doesn't use apr_table_overlap()
+ * #endif
+ * \endcode
+ *
+ * @param major The major module magic number
+ * @param minor The minor module magic number
+ * @def AP_MODULE_MAGIC_AT_LEAST(int major, int minor)
+ *}
+//#define AP_MODULE_MAGIC_AT_LEAST(major,minor)           \
+//    ((major) < MODULE_MAGIC_NUMBER_MAJOR                \
+//     || ((major) == MODULE_MAGIC_NUMBER_MAJOR           \
+//         && (minor) <= MODULE_MAGIC_NUMBER_MINOR))
+
+{** @deprecated present for backwards compatibility *}
+  MODULE_MAGIC_NUMBER = MODULE_MAGIC_NUMBER_MAJOR;
+//#define MODULE_MAGIC_AT_LEAST old_broken_macro_we_hope_you_are_not_using
+
+//#endif /* !APACHE_AP_MMN_H */
+(** @} *)

+ 268 - 0
packages/httpd24/src/ap_regex.inc

@@ -0,0 +1,268 @@
+{* 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.
+ *}
+
+{* Derived from PCRE's pcreposix.h.
+
+            Copyright (c) 1997-2004 University of Cambridge
+
+-----------------------------------------------------------------------------
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+    * Redistributions of source code must retain the above copyright notice,
+      this list of conditions and the following disclaimer.
+
+    * Redistributions in binary form must reproduce the above copyright
+      notice, this list of conditions and the following disclaimer in the
+      documentation and/or other materials provided with the distribution.
+
+    * Neither the name of the University of Cambridge 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 COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+-----------------------------------------------------------------------------
+*}
+
+{**
+ * @file ap_regex.h
+ * @brief Apache Regex defines
+ *}
+
+//#ifndef AP_REGEX_H
+//#define AP_REGEX_H
+
+//#include "apr.h"
+
+//* Allow for C++ users */
+
+//* Options for ap_regcomp, ap_regexec, and ap_rxplus versions: */
+const
+  AP_REG_ICASE    = $01; //** use a case-insensitive match */
+  AP_REG_NEWLINE  = $02; //** don't match newlines against '.' etc */
+  AP_REG_NOTBOL   = $04; //** ^ will not match against start-of-string */
+  AP_REG_NOTEOL   = $08; //** $ will not match against end-of-string */
+
+  AP_REG_EXTENDED = 0;   //** unused */
+  AP_REG_NOSUB    = 0;   //** unused */
+
+  AP_REG_MULTI    = $10; //* perl's /g (needs fixing) */
+  AP_REG_NOMEM    = $20; //* nomem in our code */
+  AP_REG_DOTALL   = $40; //* perl's /s flag */
+
+//* Error values: */
+  AP_REG_ASSERT   = 1;//** internal error ? */
+  AP_REG_ESPACE   = 2;//** failed to get memory */
+  AP_REG_INVARG   = 3;//** invalid argument */
+  AP_REG_NOMATCH  = 4;//** match failed */
+
+//* The structure representing a compiled regular expression. */
+type
+  Pap_regex_t = ^ap_regex_t;
+  ap_regex_t = record
+    re_pcre: Pointer;
+    re_nsub: Integer;
+    re_erroffset: apr_size_t;
+  end;
+
+//* The structure in which a captured offset is returned. */
+  Pap_regmatch_t = ^ap_regmatch_t;
+  ap_regmatch_t = record
+    rm_so: Integer;
+    rm_eo: Integer;
+  end;
+
+//* The functions */
+
+{**
+ * Compile a regular expression.
+ * @param preg Returned compiled regex
+ * @param regex The regular expression string
+ * @param cflags Bitwise OR of AP_REG_* flags (ICASE and NEWLINE supported,
+ *                                             other flags are ignored)
+ * @return Zero on success or non-zero on error
+ *}
+//AP_DECLARE(int) ap_regcomp(ap_regex_t *preg, const char *regex, int cflags);
+function ap_regcomp(preg: Pap_regex_t; const regex: PChar; cflags: Integer): Integer;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name LibNamePrefix + 'ap_regcomp' + LibSuff12;
+
+{**
+ * Match a NUL-terminated string against a pre-compiled regex.
+ * @param preg The pre-compiled regex
+ * @param string The string to match
+ * @param nmatch Provide information regarding the location of any matches
+ * @param pmatch Provide information regarding the location of any matches
+ * @param eflags Bitwise OR of AP_REG_* flags (NOTBOL and NOTEOL supported,
+ *                                             other flags are ignored)
+ * @return 0 for successful match, \p AP_REG_NOMATCH otherwise
+ *}
+//AP_DECLARE(int) ap_regexec(const ap_regex_t *preg, const char *string,
+//                           apr_size_t nmatch, ap_regmatch_t *pmatch, int eflags);
+function ap_regexec(const preg: Pap_regex_t; const string_: PChar;
+                    nmatch: apr_size_t; pmatch: Pap_regmatch_t; eflags: Integer): Integer;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name LibNamePrefix + 'ap_regexec' + LibSuff20;
+
+{**
+ * Match a string with given length against a pre-compiled regex. The string
+ * does not need to be NUL-terminated.
+ * @param preg The pre-compiled regex
+ * @param buff The string to match
+ * @param len Length of the string to match
+ * @param nmatch Provide information regarding the location of any matches
+ * @param pmatch Provide information regarding the location of any matches
+ * @param eflags Bitwise OR of AP_REG_* flags (NOTBOL and NOTEOL supported,
+ *                                             other flags are ignored)
+ * @return 0 for successful match, AP_REG_NOMATCH otherwise
+ *}
+//AP_DECLARE(int) ap_regexec_len(const ap_regex_t *preg, const char *buff,
+//                               apr_size_t len, apr_size_t nmatch,
+//                               ap_regmatch_t *pmatch, int eflags);
+function ap_regexec_len(const preg: Pap_regex_t; const buff: PChar;
+                        len, nmatch: apr_size_t;
+                        pmatch: Pap_regmatch_t; eflags: Integer): Integer;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name LibNamePrefix + 'ap_regexec_len' + LibSuff24;
+
+{**
+ * Return the error code returned by regcomp or regexec into error messages
+ * @param errcode the error code returned by regexec or regcomp
+ * @param preg The precompiled regex
+ * @param errbuf A buffer to store the error in
+ * @param errbuf_size The size of the buffer
+ *}
+//AP_DECLARE(apr_size_t) ap_regerror(int errcode, const ap_regex_t *preg,
+//                                   char *errbuf, apr_size_t errbuf_size);
+function ap_regerror(errcode: Integer; const preg: Pap_regex_t;
+                     errbuf: PChar; errbuf_size: apr_size_t): apr_size_t;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name LibNamePrefix + 'ap_regerror' + LibSuff16;
+
+{** Destroy a pre-compiled regex.
+ * @param preg The pre-compiled regex to free.
+ *}
+//AP_DECLARE(void) ap_regfree(ap_regex_t *preg);
+procedure ap_regfree(preg: Pap_regex_t);
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name LibNamePrefix + 'ap_regfree' + LibSuff4;
+
+//* ap_rxplus: higher-level regexps */
+type
+  Pap_rxplus_t = ^ap_rxplus_t;
+  ap_rxplus_t = record
+    rx: ap_regex_t;
+    flags: apr_uint32_t;
+    subs,
+    match: PChar;
+    nmatch: apr_size_t;
+    pmatch: Pap_regmatch_t;
+  end;{ap_rxplus_t}
+
+{**
+ * Compile a pattern into a regexp.
+ * supports perl-like formats
+ *    match-string
+ *    /match-string/flags
+ *    s/match-string/replacement-string/flags
+ *    Intended to support more perl-like stuff as and when round tuits happen
+ * match-string is anything supported by ap_regcomp
+ * replacement-string is a substitution string as supported in ap_pregsub
+ * flags should correspond with perl syntax: treat failure to do so as a bug
+ *                                           (documentation TBD)
+ * @param pool Pool to allocate from
+ * @param pattern Pattern to compile
+ * @return Compiled regexp, or NULL in case of compile/syntax error
+ *}
+//AP_DECLARE(ap_rxplus_t*) ap_rxplus_compile(apr_pool_t *pool, const char *pattern);
+function ap_rxplus_compile(pool: Papr_pool_t; const pattern: PChar): Pap_rxplus_t;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name LibNamePrefix + 'ap_rxplus_compile' + LibSuff8;
+
+{**
+ * Apply a regexp operation to a string.
+ * @param pool Pool to allocate from
+ * @param rx The regex match to apply
+ * @param pattern The string to apply it to
+ *                NOTE: This MUST be kept in scope to use regexp memory
+ * @param newpattern The modified string (ignored if the operation doesn't
+ *                                        modify the string)
+ * @return Number of times a match happens.  Normally 0 (no match) or 1
+ *         (match found), but may be greater if a transforming pattern
+ *         is applied with the 'g' flag.
+ *}
+//AP_DECLARE(int) ap_rxplus_exec(apr_pool_t *pool, ap_rxplus_t *rx,
+//                               const char *pattern, char **newpattern);
+function ap_rxplus_exec(pool: Papr_pool_t; rx: Pap_rxplus_t;
+                        const pattern: PChar; newpattern: PPChar): Integer;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name LibNamePrefix + 'ap_rxplus_exec' + LibSuff16;
+
+{#ifdef DOXYGEN
+/**
+ * Number of matches in the regexp operation's memory
+ * This may be 0 if no match is in memory, or up to nmatch from compilation
+ * @param rx The regexp
+ * @return Number of matches in memory
+ */
+AP_DECLARE(int) ap_rxplus_nmatch(ap_rxplus_t *rx);
+#else
+#define ap_rxplus_nmatch(rx) (((rx)->match != NULL) ? (rx)->nmatch : 0)
+#endif}
+
+{**
+ * Get a pointer to a match from regex memory
+ * NOTE: this relies on the match pattern from the last call to
+ *       ap_rxplus_exec still being valid (i.e. not freed or out-of-scope)
+ * @param rx The regexp
+ * @param n The match number to retrieve (must be between 0 and nmatch)
+ * @param len Returns the length of the match.
+ * @param match Returns the match pattern
+ *}
+//AP_DECLARE(void) ap_rxplus_match(ap_rxplus_t *rx, int n, int *len,
+//                                 const char **match);
+procedure ap_rxplus_match(rx: Pap_rxplus_t; len: Integer;
+                          const match: PPChar);
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name LibNamePrefix + 'ap_rxplus_match' + LibSuff16;
+
+{**
+ * Get a match from regex memory in a string copy
+ * NOTE: this relies on the match pattern from the last call to
+ *       ap_rxplus_exec still being valid (i.e. not freed or out-of-scope)
+ * @param pool Pool to allocate from
+ * @param rx The regexp
+ * @param n The match number to retrieve (must be between 0 and nmatch)
+ * @return The matched string
+ *}
+//AP_DECLARE(char*) ap_rxplus_pmatch(apr_pool_t *pool, ap_rxplus_t *rx, int n);
+//
+function ap_rxplus_pmatch(pool: Papr_pool_t; rx: Pap_rxplus_t; n: Integer): PChar;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name LibNamePrefix + 'ap_rxplus_pmatch' + LibSuff12;
+
+//#endif /* AP_REGEX_T */
+

+ 77 - 0
packages/httpd24/src/ap_release.inc

@@ -0,0 +1,77 @@
+{* 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.
+ *}
+
+{**
+ * @file ap_release.h
+ * @brief Version Release defines
+ *}
+
+{$ifndef AP_RELEASE_H}
+{$define AP_RELEASE_H}
+
+//#include "apr_general.h" /* stringify */
+
+const
+  AP_SERVER_COPYRIGHT = 'Copyright 2012 The Apache Software Foundation.';
+
+{*
+ * The below defines the base string of the Server: header. Additional
+ * tokens can be added via the ap_add_version_component() API call.
+ *
+ * The tokens are listed in order of their significance for identifying the
+ * application.
+ *
+ * "Product tokens should be short and to the point -- use of them for
+ * advertizing or other non-essential information is explicitly forbidden."
+ *
+ * Example: "Apache/1.1.0 MrWidget/0.1-alpha"
+ *}
+  AP_SERVER_BASEVENDOR = 'Apache Software Foundation';
+  AP_SERVER_BASEPROJECT = 'Apache HTTP Server';
+  AP_SERVER_BASEPRODUCT = 'Apache';
+
+  AP_SERVER_MAJORVERSION_NUMBER    = 2;
+  AP_SERVER_MINORVERSION_NUMBER    = 4;
+  AP_SERVER_PATCHLEVEL_NUMBER      = 3;
+  AP_SERVER_DEVBUILD_BOOLEAN       = 0;
+//  AP_SERVER_ADD_STRING             = '-dev';
+
+{* Synchronize the above with docs/manual/style/version.ent *}
+
+//#if !AP_SERVER_DEVBUILD_BOOLEAN
+//#undef AP_SERVER_ADD_STRING
+//#define AP_SERVER_ADD_STRING          ""
+  AP_SERVER_ADD_STRING             = '';
+//#endif
+
+{* keep old macros as well *}
+{
+#define AP_SERVER_MAJORVERSION  APR_STRINGIFY(AP_SERVER_MAJORVERSION_NUMBER)
+#define AP_SERVER_MINORVERSION  APR_STRINGIFY(AP_SERVER_MINORVERSION_NUMBER)
+#define AP_SERVER_PATCHLEVEL    APR_STRINGIFY(AP_SERVER_PATCHLEVEL_NUMBER) \
+                                AP_SERVER_ADD_STRING
+
+#define AP_SERVER_MINORREVISION AP_SERVER_MAJORVERSION "." AP_SERVER_MINORVERSION
+#define AP_SERVER_BASEREVISION  AP_SERVER_MINORREVISION "." AP_SERVER_PATCHLEVEL
+#define AP_SERVER_BASEVERSION   AP_SERVER_BASEPRODUCT "/" AP_SERVER_BASEREVISION
+#define AP_SERVER_VERSION       AP_SERVER_BASEVERSION
+
+/* macro for Win32 .rc files using numeric csv representation */
+#define AP_SERVER_PATCHLEVEL_CSV AP_SERVER_MAJORVERSION_NUMBER, \
+                                 AP_SERVER_MINORVERSION_NUMBER, \
+                                 AP_SERVER_PATCHLEVEL_NUMBER
+}
+{$endif}

+ 142 - 0
packages/httpd24/src/apr/apr.pas

@@ -0,0 +1,142 @@
+{ 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.
+  }
+unit apr;
+{$ifdef fpc}
+  {$mode delphi}{$H+}
+{$endif}
+{$ifdef Unix}
+  {$PACKRECORDS C}
+{$endif}
+
+{$DEFINE Apache2_4}
+{$DEFINE FPCAPACHE_2_4}
+
+interface
+
+uses
+{$ifdef WINDOWS}
+  Windows,
+{$ELSE}
+  UnixType,
+{$ENDIF}
+  SysUtils, ctypes;
+  
+const
+{$IFDEF WINDOWS}
+  LibAPR = 'libapr-1.dll';
+{$ELSE}
+  LibAPR = '';
+{$ENDIF}
+
+{$IF DEFINED(WINDOWS) AND NOT DEFINED(WIN64)}//Win64 is same as Linux, no funky function name changes
+  LibNamePrefix = '_';
+  LibSuff_ = '_';
+  LibSuff0 = '@0';
+  LibSuff4 = '@4';
+  LibSuff8 = '@8';
+  LibSuff12 = '@12';
+  LibSuff16 = '@16';
+  LibSuff20 = '@20';
+  LibSuff24 = '@24';
+  LibSuff28 = '@28';
+  LibSuff32 = '@32';
+{$ELSE}
+  LibNamePrefix = '';
+  LibSuff_ = '_';
+  LibSuff0 = '';
+  LibSuff4 = '';
+  LibSuff8 = '';
+  LibSuff12 = '';
+  LibSuff16 = '';
+  LibSuff20 = '';
+  LibSuff24 = '';
+  LibSuff28 = '';
+  LibSuff32 = '';
+{$ENDIF}
+
+{**********************************************************}
+{ Declarations moved here to be on top of all declarations }
+{**********************************************************}
+{from apr-util-X.X.X/include/apr_hooks.h}
+//* Hook orderings */
+//** run this hook first, before ANYTHING */
+APR_HOOK_REALLY_FIRST    = (-10);
+//** run this hook first */
+APR_HOOK_FIRST           = 0;
+//** run this hook somewhere */
+APR_HOOK_MIDDLE		 = 10;
+//** run this hook after every other hook which is defined*/
+APR_HOOK_LAST		 = 20;
+//** run this hook last, after EVERYTHING */
+APR_HOOK_REALLY_LAST	 = 30;
+
+type
+  apr_int64_t = Int64;
+  apr_uint64_t = QWord;
+  apr_off_t = Int64;
+  Papr_off_t = ^apr_off_t;
+  apr_size_t = size_t;
+  Papr_size_t = ^apr_size_t;
+  apr_int32_t = LongInt;
+  apr_uint32_t = LongWord;
+  apr_ino_t = apr_uint64_t;
+  pid_t = Longint;
+  Ppid_t = ^pid_t;
+  time_t = LongInt;//ansi time_t
+  Papr_file_t = Pointer;//
+  Pap_filter_t = Pointer;//temporary, it is in util_filter.inc
+
+  {from apr_hash.h (real struct is defined in apr_hash.c)}
+  apr_hash_t = record end;
+  Papr_hash_t = ^apr_hash_t;
+
+  {apr_bucket_alloc_t is found in apr-util-X.X.X/buckets/apr_buckets_alloc.c
+   and not .h header file declared}
+  Papr_bucket_alloc_t = Pointer;//^apr_bucket_alloc_t;
+
+{$IFNDEF WINDOWS}
+  va_list = Pointer;
+{$ENDIF}
+
+{$include apr_errno.inc}
+{$include apr_pools.inc}
+//{$include apr_general.inc}
+//{$include apr_dso.inc}
+{$include apr_user.inc}
+{$include apr_time.inc}
+{$include apr_tables.inc}
+{$include apr_file_info.inc}
+//{$include apr_file_io.inc}
+{$include apr_strings.inc}
+//{$include apr_lib.inc}
+//{$include apr_signal.inc}
+//{$include apr_network_io.inc}
+//{$include apr_hash.inc}
+   {.$include apr_portable.inc}
+
+   {.$include ../aprutils/apr_uri.inc}
+
+//{$include apr_thread_proc.inc}
+{$include apr_version.inc}
+//{$include apr_poll.inc}
+
+//moved from http_protocol.h(http_protocol.inc)
+{$include apr_mmap.inc}
+
+implementation
+
+
+end.

+ 142 - 0
packages/httpd24/src/apr/apr24.pas

@@ -0,0 +1,142 @@
+{ 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.
+  }
+unit apr24;
+{$ifdef fpc}
+  {$mode delphi}{$H+}
+{$endif}
+{$ifdef Unix}
+  {$PACKRECORDS C}
+{$endif}
+
+{$DEFINE Apache2_4}
+{$DEFINE FPCAPACHE_2_4}
+
+interface
+
+uses
+{$ifdef WINDOWS}
+  Windows,
+{$ELSE}
+  UnixType,
+{$ENDIF}
+  SysUtils, ctypes;
+  
+const
+{$IFDEF WINDOWS}
+  LibAPR = 'libapr-1.dll';
+{$ELSE}
+  LibAPR = '';
+{$ENDIF}
+
+{$IF DEFINED(WINDOWS) AND NOT DEFINED(WIN64)}//Win64 is same as Linux, no funky function name changes
+  LibNamePrefix = '_';
+  LibSuff_ = '_';
+  LibSuff0 = '@0';
+  LibSuff4 = '@4';
+  LibSuff8 = '@8';
+  LibSuff12 = '@12';
+  LibSuff16 = '@16';
+  LibSuff20 = '@20';
+  LibSuff24 = '@24';
+  LibSuff28 = '@28';
+  LibSuff32 = '@32';
+{$ELSE}
+  LibNamePrefix = '';
+  LibSuff_ = '_';
+  LibSuff0 = '';
+  LibSuff4 = '';
+  LibSuff8 = '';
+  LibSuff12 = '';
+  LibSuff16 = '';
+  LibSuff20 = '';
+  LibSuff24 = '';
+  LibSuff28 = '';
+  LibSuff32 = '';
+{$ENDIF}
+
+{**********************************************************}
+{ Declarations moved here to be on top of all declarations }
+{**********************************************************}
+{from apr-util-X.X.X/include/apr_hooks.h}
+//* Hook orderings */
+//** run this hook first, before ANYTHING */
+APR_HOOK_REALLY_FIRST    = (-10);
+//** run this hook first */
+APR_HOOK_FIRST           = 0;
+//** run this hook somewhere */
+APR_HOOK_MIDDLE		 = 10;
+//** run this hook after every other hook which is defined*/
+APR_HOOK_LAST		 = 20;
+//** run this hook last, after EVERYTHING */
+APR_HOOK_REALLY_LAST	 = 30;
+
+type
+  apr_int64_t = Int64;
+  apr_uint64_t = QWord;
+  apr_off_t = Int64;
+  Papr_off_t = ^apr_off_t;
+  apr_size_t = size_t;
+  Papr_size_t = ^apr_size_t;
+  apr_int32_t = LongInt;
+  apr_uint32_t = LongWord;
+  apr_ino_t = apr_uint64_t;
+  pid_t = Longint;
+  Ppid_t = ^pid_t;
+  time_t = LongInt;//ansi time_t
+  Papr_file_t = Pointer;//
+  Pap_filter_t = Pointer;//temporary, it is in util_filter.inc
+
+  {from apr_hash.h (real struct is defined in apr_hash.c)}
+  apr_hash_t = record end;
+  Papr_hash_t = ^apr_hash_t;
+
+  {apr_bucket_alloc_t is found in apr-util-X.X.X/buckets/apr_buckets_alloc.c
+   and not .h header file declared}
+  Papr_bucket_alloc_t = Pointer;//^apr_bucket_alloc_t;
+
+{$IFNDEF WINDOWS}
+  va_list = Pointer;
+{$ENDIF}
+
+{$include apr_errno.inc}
+{$include apr_pools.inc}
+//{$include apr_general.inc}
+//{$include apr_dso.inc}
+{$include apr_user.inc}
+{$include apr_time.inc}
+{$include apr_tables.inc}
+{$include apr_file_info.inc}
+//{$include apr_file_io.inc}
+{$include apr_strings.inc}
+//{$include apr_lib.inc}
+//{$include apr_signal.inc}
+//{$include apr_network_io.inc}
+//{$include apr_hash.inc}
+   {.$include apr_portable.inc}
+
+   {.$include ../aprutils/apr_uri.inc}
+
+//{$include apr_thread_proc.inc}
+{$include apr_version.inc}
+//{$include apr_poll.inc}
+
+//moved from http_protocol.h(http_protocol.inc)
+{$include apr_mmap.inc}
+
+implementation
+
+
+end.

+ 182 - 0
packages/httpd24/src/apr/apr_allocator.inc

@@ -0,0 +1,182 @@
+{* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *}
+
+{$ifndef APR_ALLOCATOR_H}
+  {$define APR_ALLOCATOR_H}
+
+{**
+ * @file apr_allocator.h
+ * @brief APR Internal Memory Allocation
+ *}
+
+//#include "apr.h"
+//#include "apr_errno.h"
+//#define APR_WANT_MEMFUNC /**< For no good reason? */
+//#include "apr_want.h"
+
+(**
+ * @defgroup apr_allocator Internal Memory Allocation
+ * @ingroup APR 
+ * @{
+ *)
+
+//** the allocator structure */
+//typedef struct apr_allocator_t apr_allocator_t;
+type
+  apr_allocator_t = record end;
+  Papr_allocator_t = ^apr_allocator_t;
+  PPapr_allocator_t = ^Papr_allocator_t;
+
+//** the structure which holds information about the allocation */
+//typedef struct apr_memnode_t apr_memnode_t;
+  Papr_memnode_t = ^apr_memnode_t;
+  PPapr_memnode_t = ^Papr_memnode_t;
+
+{** basic memory node structure
+ * @note The next, ref and first_avail fields are available for use by the
+ *       caller of apr_allocator_alloc(), the remaining fields are read-only.
+ *       The next field has to be used with caution and sensibly set when the
+ *       memnode is passed back to apr_allocator_free().  See apr_allocator_free()
+ *       for details.  
+ *       The ref and first_avail fields will be properly restored by
+ *       apr_allocator_free().
+ *}
+  apr_memnode_t = record
+    next: Papr_memnode_t;            //**< next memnode */
+    ref: PPapr_memnode_t;            //**< reference to self */
+    index: apr_uint32_t;             //**< size */
+    free_index: apr_uint32_t;        //**< how much free */
+    first_avail: PChar;              //**< pointer to first free memory */
+    endp: PChar;                     //**< pointer to end of free memory */
+  end;
+
+//** The base size of a memory node - aligned.  */
+//#define APR_MEMNODE_T_SIZE APR_ALIGN_DEFAULT(sizeof(apr_memnode_t))
+
+//** Symbolic constants */
+const
+  APR_ALLOCATOR_MAX_FREE_UNLIMITED = 0;
+
+{**
+ * Create a new allocator
+ * @param allocator The allocator we have just created.
+ *
+ *}
+//APR_DECLARE(apr_status_t) apr_allocator_create(apr_allocator_t **allocator);
+function apr_allocator_create(allocator: PPapr_allocator_t): apr_status_t;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibAPR name LibNamePrefix + 'apr_allocator_create' + LibSuff4;
+
+{**
+ * Destroy an allocator
+ * @param allocator The allocator to be destroyed
+ * @remark Any memnodes not given back to the allocator prior to destroying
+ *         will _not_ be free()d.
+ *}
+//APR_DECLARE(void) apr_allocator_destroy(apr_allocator_t *allocator);
+procedure apr_allocator_destroy(allocator: Papr_allocator_t);
+   {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+   external LibAPR name LibNamePrefix + 'apr_allocator_destroy' + LibSuff4;
+
+{**
+ * Allocate a block of mem from the allocator
+ * @param allocator The allocator to allocate from
+ * @param size The size of the mem to allocate (excluding the
+ *        memnode structure)
+ *}
+//APR_DECLARE(apr_memnode_t *) apr_allocator_alloc(apr_allocator_t *allocator,
+//                                                 apr_size_t size);
+function apr_allocator_alloc(allocator: Papr_allocator_t;
+                             size: apr_size_t): Papr_memnode_t;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibAPR name LibNamePrefix + 'apr_allocator_alloc' + LibSuff8;
+
+{**
+ * Free a list of blocks of mem, giving them back to the allocator.
+ * The list is typically terminated by a memnode with its next field
+ * set to NULL.
+ * @param allocator The allocator to give the mem back to
+ * @param memnode The memory node to return
+ *}
+//APR_DECLARE(void) apr_allocator_free(apr_allocator_t *allocator,
+//                                     apr_memnode_t *memnode);
+procedure apr_allocator_free(allocator: Papr_allocator_t; memnode: Papr_memnode_t);
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibAPR name LibNamePrefix + 'apr_allocator_free' + LibSuff8;
+
+//#include "apr_pools.h"
+
+{**
+ * Set the owner of the allocator
+ * @param allocator The allocator to set the owner for
+ * @param pool The pool that is to own the allocator
+ * @remark Typically pool is the highest level pool using the allocator
+ *}
+{*
+ * XXX: see if we can come up with something a bit better.  Currently
+ * you can make a pool an owner, but if the pool doesn't use the allocator
+ * the allocator will never be destroyed.
+ *}
+//APR_DECLARE(void) apr_allocator_owner_set(apr_allocator_t *allocator,
+//                                          apr_pool_t *pool);
+procedure apr_allocator_owner_set(allocator: Papr_allocator_t; pool: Papr_pool_t);
+   {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+   external LibAPR name LibNamePrefix + 'apr_allocator_owner_set' + LibSuff8;
+
+{**
+ * Get the current owner of the allocator
+ * @param allocator The allocator to get the owner from
+ *}
+//APR_DECLARE(apr_pool_t *) apr_allocator_owner_get(apr_allocator_t *allocator);
+function apr_allocator_owner_get(allocator: Papr_allocator_t): Papr_pool_t;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibAPR name LibNamePrefix + 'apr_allocator_owner_get' + LibSuff4;
+
+{**
+ * Set the current threshold at which the allocator should start
+ * giving blocks back to the system.
+ * @param allocator The allocator the set the threshold on
+ * @param size The threshold.  0 == unlimited.
+ *}
+//APR_DECLARE(void) apr_allocator_max_free_set(apr_allocator_t *allocator,
+//                                             apr_size_t size);
+procedure apr_allocator_max_free_set(allocator: Papr_allocator_t; size: apr_size_t);
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibAPR name LibNamePrefix + 'apr_allocator_max_free_set' + LibSuff8;
+
+//#include "apr_thread_mutex.h"
+
+{$ifdef APR_HAS_THREADS}
+{**
+ * Set a mutex for the allocator to use
+ * @param allocator The allocator to set the mutex for
+ * @param mutex The mutex
+ *}
+//APR_DECLARE(void) apr_allocator_mutex_set(apr_allocator_t *allocator,
+//                                          apr_thread_mutex_t *mutex);
+
+{**
+ * Get the mutex currently set for the allocator
+ * @param allocator The allocator
+ *}
+//APR_DECLARE(apr_thread_mutex_t *) apr_allocator_mutex_get(
+//                                      apr_allocator_t *allocator);
+
+{$endif} //* APR_HAS_THREADS */
+
+(** @} *)
+
+{$endif} //* !APR_ALLOCATOR_H */

+ 1319 - 0
packages/httpd24/src/apr/apr_errno.inc

@@ -0,0 +1,1319 @@
+{* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *}
+
+{$ifndef APR_ERRNO_H}
+  {$define APR_ERRNO_H}
+
+{**
+ * @file apr_errno.h
+ * @brief APR Error Codes
+ *}
+
+//#include "apr.h"
+
+//#if APR_HAVE_ERRNO_H
+//#include <errno.h>
+//#endif
+
+(**
+ * @defgroup apr_errno Error Codes
+ * @ingroup APR
+ * @{
+ *)
+
+{**
+ * Type for specifying an error or status code.
+ *}
+//typedef int apr_status_t;
+type
+  Papr_status_t = ^apr_status_t;
+  apr_status_t = longint;
+
+{**
+ * Return a human readable string describing the specified error.
+ * @param statcode The error code the get a string for.
+ * @param buf A buffer to hold the error string.
+ * @param bufsize Size of the buffer to hold the string.
+ *}
+//APR_DECLARE(char *) apr_strerror(apr_status_t statcode, char *buf,
+//                                 apr_size_t bufsize);
+function apr_strerror(statcode: apr_status_t; buf: PChar; bufsize: apr_size_t): PChar;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibAPR name LibNamePrefix + 'apr_strerror' + LibSuff12;
+
+(*
+#if defined(DOXYGEN)
+{**
+ * @def APR_FROM_OS_ERROR(os_err_type syserr)
+ * Fold a platform specific error into an apr_status_t code.
+ * @return apr_status_t
+ * @param e The platform os error code.
+ * @warning  macro implementation; the syserr argument may be evaluated
+ *      multiple times.
+ *}
+#define APR_FROM_OS_ERROR(e) (e == 0 ? APR_SUCCESS : e + APR_OS_START_SYSERR)
+
+{**
+ * @def APR_TO_OS_ERROR(apr_status_t statcode)
+ * @return os_err_type
+ * Fold an apr_status_t code back to the native platform defined error.
+ * @param e The apr_status_t folded platform os error code.
+ * @warning  macro implementation; the statcode argument may be evaluated
+ *      multiple times.  If the statcode was not created by apr_get_os_error
+ *      or APR_FROM_OS_ERROR, the results are undefined.
+ *}
+#define APR_TO_OS_ERROR(e) (e == 0 ? APR_SUCCESS : e - APR_OS_START_SYSERR)
+
+{** @def apr_get_os_error()
+ * @return apr_status_t the last platform error, folded into apr_status_t, on most platforms
+ * @remark This retrieves errno, or calls a GetLastError() style function, and
+ *      folds it with APR_FROM_OS_ERROR.  Some platforms (such as OS2) have no
+ *      such mechanism, so this call may be unsupported.  Do NOT use this
+ *      call for socket errors from socket, send, recv etc!
+ *}
+
+{** @def apr_set_os_error(e)
+ * Reset the last platform error, unfolded from an apr_status_t, on some platforms
+ * @param e The OS error folded in a prior call to APR_FROM_OS_ERROR()
+ * @warning This is a macro implementation; the statcode argument may be evaluated
+ *      multiple times.  If the statcode was not created by apr_get_os_error
+ *      or APR_FROM_OS_ERROR, the results are undefined.  This macro sets
+ *      errno, or calls a SetLastError() style function, unfolding statcode
+ *      with APR_TO_OS_ERROR.  Some platforms (such as OS2) have no such
+ *      mechanism, so this call may be unsupported.
+ *}
+
+{** @def apr_get_netos_error()
+ * Return the last socket error, folded into apr_status_t, on all platforms
+ * @remark This retrieves errno or calls a GetLastSocketError() style function,
+ *      and folds it with APR_FROM_OS_ERROR.
+ *}
+
+{** @def apr_set_netos_error(e)
+ * Reset the last socket error, unfolded from an apr_status_t
+ * @param e The socket error folded in a prior call to APR_FROM_OS_ERROR()
+ * @warning This is a macro implementation; the statcode argument may be evaluated
+ *      multiple times.  If the statcode was not created by apr_get_os_error
+ *      or APR_FROM_OS_ERROR, the results are undefined.  This macro sets
+ *      errno, or calls a WSASetLastError() style function, unfolding
+ *      socketcode with APR_TO_OS_ERROR.
+ *}
+
+#endif /* defined(DOXYGEN) */
+*)
+
+const
+{**
+ * APR_OS_START_ERROR is where the APR specific error values start.
+ *}
+  APR_OS_START_ERROR = 20000;
+
+{**
+ * APR_OS_ERRSPACE_SIZE is the maximum number of errors you can fit
+ *    into one of the error/status ranges below -- except for
+ *    APR_OS_START_USERERR, which see.
+ *}
+  APR_OS_ERRSPACE_SIZE = 50000;
+{**
+ * APR_UTIL_ERRSPACE_SIZE is the size of the space that is reserved for
+ * use within apr-util. This space is reserved above that used by APR
+ * internally.
+ * @note This number MUST be smaller than APR_OS_ERRSPACE_SIZE by a
+ *       large enough amount that APR has sufficient room for it's
+ *       codes.
+ *}
+  APR_UTIL_ERRSPACE_SIZE = 20000;
+{**
+ * APR_OS_START_STATUS is where the APR specific status codes start.
+ *}
+  APR_OS_START_STATUS = APR_OS_START_ERROR+APR_OS_ERRSPACE_SIZE;
+{**
+ * APR_UTIL_START_STATUS is where APR-Util starts defining it's
+ * status codes.
+ *}
+  APR_UTIL_START_STATUS = APR_OS_START_STATUS+(APR_OS_ERRSPACE_SIZE-APR_UTIL_ERRSPACE_SIZE);
+{**
+ * APR_OS_START_USERERR are reserved for applications that use APR that
+ *     layer their own error codes along with APR's.  Note that the
+ *     error immediately following this one is set ten times farther
+ *     away than usual, so that users of apr have a lot of room in
+ *     which to declare custom error codes.
+ *
+ * In general applications should try and create unique error codes. To try
+ * and assist in finding suitable ranges of numbers to use, the following
+ * ranges are known to be used by the listed applications. If your
+ * application defines error codes please advise the range of numbers it
+ * uses to [email protected] for inclusion in this list.
+ *
+ * Ranges shown are in relation to APR_OS_START_USERERR
+ *
+ * Subversion - Defined ranges, of less than 100, at intervals of 5000
+ *              starting at an offset of 5000, e.g.
+ *               +5000 to 5100,  +10000 to 10100
+ *
+ * Apache HTTPD - +2000 to 2999
+ *}
+ APR_OS_START_USERERR = APR_OS_START_STATUS+APR_OS_ERRSPACE_SIZE;
+{**
+ * APR_OS_START_USEERR is obsolete, defined for compatibility only.
+ * Use APR_OS_START_USERERR instead.
+ *}
+ APR_OS_START_USEERR = APR_OS_START_USERERR;
+{**
+ * APR_OS_START_CANONERR is where APR versions of errno values are defined
+ *     on systems which don't have the corresponding errno.
+ *}
+ APR_OS_START_CANONERR = (APR_OS_START_USERERR + (APR_OS_ERRSPACE_SIZE * 10));
+{**
+ * APR_OS_START_EAIERR folds EAI_ error codes from getaddrinfo() into
+ *     apr_status_t values.
+ *}
+ APR_OS_START_EAIERR = APR_OS_START_CANONERR+APR_OS_ERRSPACE_SIZE;
+{**
+ * APR_OS_START_SYSERR folds platform-specific system error values into
+ *     apr_status_t values.
+ *}
+ APR_OS_START_SYSERR = APR_OS_START_EAIERR+APR_OS_ERRSPACE_SIZE;
+
+{**
+ * @defgroup APR_ERROR_map APR Error Space
+ * <PRE>
+ * The following attempts to show the relation of the various constants
+ * used for mapping APR Status codes.
+ *
+ *       0
+ *
+ *  20,000     APR_OS_START_ERROR
+ *
+ *         + APR_OS_ERRSPACE_SIZE (50,000)
+ *
+ *  70,000      APR_OS_START_STATUS
+ *
+ *         + APR_OS_ERRSPACE_SIZE - APR_UTIL_ERRSPACE_SIZE (30,000)
+ *
+ * 100,000      APR_UTIL_START_STATUS
+ *
+ *         + APR_UTIL_ERRSPACE_SIZE (20,000)
+ *
+ * 120,000      APR_OS_START_USERERR
+ *
+ *         + 10 x APR_OS_ERRSPACE_SIZE (50,000 * 10)
+ *
+ * 620,000      APR_OS_START_CANONERR
+ *
+ *         + APR_OS_ERRSPACE_SIZE (50,000)
+ *
+ * 670,000      APR_OS_START_EAIERR
+ *
+ *         + APR_OS_ERRSPACE_SIZE (50,000)
+ *
+ * 720,000      APR_OS_START_SYSERR
+ *
+ * </PRE>
+ *}
+
+//** no error. */
+ APR_SUCCESS = 0;
+
+(**
+ * @defgroup APR_Error APR Error Values
+ * <PRE>
+ * <b>APR ERROR VALUES</b>
+ * APR_ENOSTAT      APR was unable to perform a stat on the file
+ * APR_ENOPOOL      APR was not provided a pool with which to allocate memory
+ * APR_EBADDATE     APR was given an invalid date
+ * APR_EINVALSOCK   APR was given an invalid socket
+ * APR_ENOPROC      APR was not given a process structure
+ * APR_ENOTIME      APR was not given a time structure
+ * APR_ENODIR       APR was not given a directory structure
+ * APR_ENOLOCK      APR was not given a lock structure
+ * APR_ENOPOLL      APR was not given a poll structure
+ * APR_ENOSOCKET    APR was not given a socket
+ * APR_ENOTHREAD    APR was not given a thread structure
+ * APR_ENOTHDKEY    APR was not given a thread key structure
+ * APR_ENOSHMAVAIL  There is no more shared memory available
+ * APR_EDSOOPEN     APR was unable to open the dso object.  For more
+ *                  information call apr_dso_error().
+ * APR_EGENERAL     General failure (specific information not available)
+ * APR_EBADIP       The specified IP address is invalid
+ * APR_EBADMASK     The specified netmask is invalid
+ * APR_ESYMNOTFOUND Could not find the requested symbol
+ * APR_ENOTENOUGHENTROPY Not enough entropy to continue
+ * </PRE>
+ *
+ * <PRE>
+ * <b>APR STATUS VALUES</b>
+ * APR_INCHILD        Program is currently executing in the child
+ * APR_INPARENT       Program is currently executing in the parent
+ * APR_DETACH         The thread is detached
+ * APR_NOTDETACH      The thread is not detached
+ * APR_CHILD_DONE     The child has finished executing
+ * APR_CHILD_NOTDONE  The child has not finished executing
+ * APR_TIMEUP         The operation did not finish before the timeout
+ * APR_INCOMPLETE     The operation was incomplete although some processing
+ *                    was performed and the results are partially valid
+ * APR_BADCH          Getopt found an option not in the option string
+ * APR_BADARG         Getopt found an option that is missing an argument
+ *                    and an argument was specified in the option string
+ * APR_EOF            APR has encountered the end of the file
+ * APR_NOTFOUND       APR was unable to find the socket in the poll structure
+ * APR_ANONYMOUS      APR is using anonymous shared memory
+ * APR_FILEBASED      APR is using a file name as the key to the shared memory
+ * APR_KEYBASED       APR is using a shared key as the key to the shared memory
+ * APR_EINIT          Ininitalizer value.  If no option has been found, but
+ *                    the status variable requires a value, this should be used
+ * APR_ENOTIMPL       The APR function has not been implemented on this
+ *                    platform, either because nobody has gotten to it yet,
+ *                    or the function is impossible on this platform.
+ * APR_EMISMATCH      Two passwords do not match.
+ * APR_EABSOLUTE      The given path was absolute.
+ * APR_ERELATIVE      The given path was relative.
+ * APR_EINCOMPLETE    The given path was neither relative nor absolute.
+ * APR_EABOVEROOT     The given path was above the root path.
+ * APR_EBUSY          The given lock was busy.
+ * APR_EPROC_UNKNOWN  The given process wasn't recognized by APR
+ * </PRE>
+ * @{
+ *)
+//** @see APR_STATUS_IS_ENOSTAT */
+ APR_ENOSTAT =          (APR_OS_START_ERROR + 1);
+//** @see APR_STATUS_IS_ENOPOOL */
+ APR_ENOPOOL =          (APR_OS_START_ERROR + 2);
+//* empty slot: +3 */
+//** @see APR_STATUS_IS_EBADDATE */
+APR_EBADDATE =          (APR_OS_START_ERROR + 4);
+//** @see APR_STATUS_IS_EINVALSOCK */
+APR_EINVALSOCK =        (APR_OS_START_ERROR + 5);
+//** @see APR_STATUS_IS_ENOPROC */
+APR_ENOPROC =           (APR_OS_START_ERROR + 6);
+//** @see APR_STATUS_IS_ENOTIME */
+APR_ENOTIME =           (APR_OS_START_ERROR + 7);
+//** @see APR_STATUS_IS_ENODIR */
+APR_ENODIR =            (APR_OS_START_ERROR + 8);
+//** @see APR_STATUS_IS_ENOLOCK */
+APR_ENOLOCK =           (APR_OS_START_ERROR + 9);
+//** @see APR_STATUS_IS_ENOPOLL */
+APR_ENOPOLL =           (APR_OS_START_ERROR + 10);
+//** @see APR_STATUS_IS_ENOSOCKET */
+APR_ENOSOCKET =         (APR_OS_START_ERROR + 11);
+//** @see APR_STATUS_IS_ENOTHREAD */
+APR_ENOTHREAD =         (APR_OS_START_ERROR + 12);
+//** @see APR_STATUS_IS_ENOTHDKEY */
+APR_ENOTHDKEY =         (APR_OS_START_ERROR + 13);
+//** @see APR_STATUS_IS_EGENERAL */
+APR_EGENERAL =          (APR_OS_START_ERROR + 14);
+//** @see APR_STATUS_IS_ENOSHMAVAIL */
+APR_ENOSHMAVAIL =       (APR_OS_START_ERROR + 15);
+//** @see APR_STATUS_IS_EBADIP */
+APR_EBADIP =            (APR_OS_START_ERROR + 16);
+//** @see APR_STATUS_IS_EBADMASK */
+APR_EBADMASK =          (APR_OS_START_ERROR + 17);
+//* empty slot: +18 */
+//** @see APR_STATUS_IS_EDSOPEN */
+APR_EDSOOPEN =          (APR_OS_START_ERROR + 19);
+//** @see APR_STATUS_IS_EABSOLUTE */
+APR_EABSOLUTE =         (APR_OS_START_ERROR + 20);
+//** @see APR_STATUS_IS_ERELATIVE */
+APR_ERELATIVE =         (APR_OS_START_ERROR + 21);
+//** @see APR_STATUS_IS_EINCOMPLETE */
+APR_EINCOMPLETE =       (APR_OS_START_ERROR + 22);
+//** @see APR_STATUS_IS_EABOVEROOT */
+APR_EABOVEROOT =        (APR_OS_START_ERROR + 23);
+//** @see APR_STATUS_IS_EBADPATH */
+APR_EBADPATH =          (APR_OS_START_ERROR + 24);
+//** @see APR_STATUS_IS_EPATHWILD */
+APR_EPATHWILD =         (APR_OS_START_ERROR + 25);
+//** @see APR_STATUS_IS_ESYMNOTFOUND */
+APR_ESYMNOTFOUND =      (APR_OS_START_ERROR + 26);
+//** @see APR_STATUS_IS_EPROC_UNKNOWN */
+APR_EPROC_UNKNOWN =     (APR_OS_START_ERROR + 27);
+//** @see APR_STATUS_IS_ENOTENOUGHENTROPY */
+APR_ENOTENOUGHENTROPY = (APR_OS_START_ERROR + 28);
+//** @}
+
+(**
+ * @defgroup APR_STATUS_IS Status Value Tests
+ * @warning For any particular error condition, more than one of these tests
+ *      may match. This is because platform-specific error codes may not
+ *      always match the semantics of the POSIX codes these tests (and the
+ *      corresponding APR error codes) are named after. A notable example
+ *      are the APR_STATUS_IS_ENOENT and APR_STATUS_IS_ENOTDIR tests on
+ *      Win32 platforms. The programmer should always be aware of this and
+ *      adjust the order of the tests accordingly.
+ * @{
+ *)
+{**
+ * APR was unable to perform a stat on the file
+ * @warning always use this test, as platform-specific variances may meet this
+ * more than one error code
+ *}
+//#define APR_STATUS_IS_ENOSTAT(s)        ((s) == APR_ENOSTAT)
+{fpc -> can be converted to a function if needed, as well as the below ones}
+
+(*
+{**
+ * APR was not provided a pool with which to allocate memory
+ * @warning always use this test, as platform-specific variances may meet this
+ * more than one error code
+ *}
+#define APR_STATUS_IS_ENOPOOL(s)        ((s) == APR_ENOPOOL)
+//** APR was given an invalid date  */
+#define APR_STATUS_IS_EBADDATE(s)       ((s) == APR_EBADDATE)
+//** APR was given an invalid socket */
+#define APR_STATUS_IS_EINVALSOCK(s)     ((s) == APR_EINVALSOCK)
+//** APR was not given a process structure */
+#define APR_STATUS_IS_ENOPROC(s)        ((s) == APR_ENOPROC)
+//** APR was not given a time structure */
+#define APR_STATUS_IS_ENOTIME(s)        ((s) == APR_ENOTIME)
+//** APR was not given a directory structure */
+#define APR_STATUS_IS_ENODIR(s)         ((s) == APR_ENODIR)
+//** APR was not given a lock structure */
+#define APR_STATUS_IS_ENOLOCK(s)        ((s) == APR_ENOLOCK)
+//** APR was not given a poll structure */
+#define APR_STATUS_IS_ENOPOLL(s)        ((s) == APR_ENOPOLL)
+//** APR was not given a socket */
+#define APR_STATUS_IS_ENOSOCKET(s)      ((s) == APR_ENOSOCKET)
+//** APR was not given a thread structure */
+#define APR_STATUS_IS_ENOTHREAD(s)      ((s) == APR_ENOTHREAD)
+//** APR was not given a thread key structure */
+#define APR_STATUS_IS_ENOTHDKEY(s)      ((s) == APR_ENOTHDKEY)
+//** Generic Error which can not be put into another spot */
+#define APR_STATUS_IS_EGENERAL(s)       ((s) == APR_EGENERAL)
+//** There is no more shared memory available */
+#define APR_STATUS_IS_ENOSHMAVAIL(s)    ((s) == APR_ENOSHMAVAIL)
+//** The specified IP address is invalid */
+#define APR_STATUS_IS_EBADIP(s)         ((s) == APR_EBADIP)
+//** The specified netmask is invalid */
+#define APR_STATUS_IS_EBADMASK(s)       ((s) == APR_EBADMASK)
+//* empty slot: +18 */
+{**
+ * APR was unable to open the dso object.
+ * For more information call apr_dso_error().
+ *}
+#if defined(WIN32)
+#define APR_STATUS_IS_EDSOOPEN(s)       ((s) == APR_EDSOOPEN \
+                       || APR_TO_OS_ERROR(s) == ERROR_MOD_NOT_FOUND)
+#else
+#define APR_STATUS_IS_EDSOOPEN(s)       ((s) == APR_EDSOOPEN)
+#endif
+//** The given path was absolute. */
+#define APR_STATUS_IS_EABSOLUTE(s)      ((s) == APR_EABSOLUTE)
+//** The given path was relative. */
+#define APR_STATUS_IS_ERELATIVE(s)      ((s) == APR_ERELATIVE)
+//** The given path was neither relative nor absolute. */
+#define APR_STATUS_IS_EINCOMPLETE(s)    ((s) == APR_EINCOMPLETE)
+//** The given path was above the root path. */
+#define APR_STATUS_IS_EABOVEROOT(s)     ((s) == APR_EABOVEROOT)
+//** The given path was bad. */
+#define APR_STATUS_IS_EBADPATH(s)       ((s) == APR_EBADPATH)
+//** The given path contained wildcards. */
+#define APR_STATUS_IS_EPATHWILD(s)      ((s) == APR_EPATHWILD)
+{** Could not find the requested symbol.
+ * For more information call apr_dso_error().
+ *}
+#if defined(WIN32)
+#define APR_STATUS_IS_ESYMNOTFOUND(s)   ((s) == APR_ESYMNOTFOUND \
+                       || APR_TO_OS_ERROR(s) == ERROR_PROC_NOT_FOUND)
+#else
+#define APR_STATUS_IS_ESYMNOTFOUND(s)   ((s) == APR_ESYMNOTFOUND)
+#endif
+//** The given process was not recognized by APR. */
+#define APR_STATUS_IS_EPROC_UNKNOWN(s)  ((s) == APR_EPROC_UNKNOWN)
+//** APR could not gather enough entropy to continue. */
+#define APR_STATUS_IS_ENOTENOUGHENTROPY(s) ((s) == APR_ENOTENOUGHENTROPY)
+*)
+(** @} *)
+
+(**
+ * @addtogroup APR_Error
+ * @{
+ *)
+//** @see APR_STATUS_IS_INCHILD */
+APR_INCHILD =       APR_OS_START_STATUS+1;
+//** @see APR_STATUS_IS_INPARENT */
+APR_INPARENT =      APR_OS_START_STATUS+2;
+//** @see APR_STATUS_IS_DETACH */
+APR_DETACH =        APR_OS_START_STATUS+3;
+//** @see APR_STATUS_IS_NOTDETACH */
+APR_NOTDETACH =     APR_OS_START_STATUS+4;
+//** @see APR_STATUS_IS_CHILD_DONE */
+APR_CHILD_DONE =    APR_OS_START_STATUS+5;
+//** @see APR_STATUS_IS_CHILD_NOTDONE */
+APR_CHILD_NOTDONE = APR_OS_START_STATUS+6;
+//** @see APR_STATUS_IS_TIMEUP */
+APR_TIMEUP =        APR_OS_START_STATUS+7;
+//** @see APR_STATUS_IS_INCOMPLETE */
+APR_INCOMPLETE =    APR_OS_START_STATUS+8;
+//* empty slot: +9 */
+//* empty slot: +10 */
+//* empty slot: +11 */
+//** @see APR_STATUS_IS_BADCH */
+APR_BADCH =         APR_OS_START_STATUS+12;
+//** @see APR_STATUS_IS_BADARG */
+APR_BADARG =        APR_OS_START_STATUS+13;
+//** @see APR_STATUS_IS_EOF */
+APR_EOF =           APR_OS_START_STATUS+14;
+//** @see APR_STATUS_IS_NOTFOUND */
+APR_NOTFOUND =      APR_OS_START_STATUS+15;
+//* empty slot: +16 */
+//* empty slot: +17 */
+//* empty slot: +18 */
+//** @see APR_STATUS_IS_ANONYMOUS */
+APR_ANONYMOUS =     APR_OS_START_STATUS+19;
+//** @see APR_STATUS_IS_FILEBASED */
+APR_FILEBASED =     APR_OS_START_STATUS+20;
+//** @see APR_STATUS_IS_KEYBASED */
+APR_KEYBASED =      APR_OS_START_STATUS+21;
+//** @see APR_STATUS_IS_EINIT */
+APR_EINIT =         APR_OS_START_STATUS+22;
+//** @see APR_STATUS_IS_ENOTIMPL */
+APR_ENOTIMPL =      APR_OS_START_STATUS+23;
+//** @see APR_STATUS_IS_EMISMATCH */
+APR_EMISMATCH =     APR_OS_START_STATUS+24;
+//** @see APR_STATUS_IS_EBUSY */
+APR_EBUSY =         APR_OS_START_STATUS+25;
+//** @} */
+
+(**
+ * @addtogroup APR_STATUS_IS
+ * @{
+ *)
+{**
+ * Program is currently executing in the child
+ * @warning
+ * always use this test, as platform-specific variances may meet this
+ * more than one error code *}
+//#define APR_STATUS_IS_INCHILD(s)        ((s) == APR_INCHILD)
+{**
+ * Program is currently executing in the parent
+ * @warning
+ * always use this test, as platform-specific variances may meet this
+ * more than one error code
+ *}
+//#define APR_STATUS_IS_INPARENT(s)       ((s) == APR_INPARENT)
+{**
+ * The thread is detached
+ * @warning
+ * always use this test, as platform-specific variances may meet this
+ * more than one error code
+ *}
+//#define APR_STATUS_IS_DETACH(s)         ((s) == APR_DETACH)
+{**
+ * The thread is not detached
+ * @warning
+ * always use this test, as platform-specific variances may meet this
+ * more than one error code
+ *}
+//#define APR_STATUS_IS_NOTDETACH(s)      ((s) == APR_NOTDETACH)
+{**
+ * The child has finished executing
+ * @warning
+ * always use this test, as platform-specific variances may meet this
+ * more than one error code
+ *}
+//#define APR_STATUS_IS_CHILD_DONE(s)     ((s) == APR_CHILD_DONE)
+{**
+ * The child has not finished executing
+ * @warning
+ * always use this test, as platform-specific variances may meet this
+ * more than one error code
+ *}
+//#define APR_STATUS_IS_CHILD_NOTDONE(s)  ((s) == APR_CHILD_NOTDONE)
+{**
+ * The operation did not finish before the timeout
+ * @warning
+ * always use this test, as platform-specific variances may meet this
+ * more than one error code
+ *}
+//#define APR_STATUS_IS_TIMEUP(s)         ((s) == APR_TIMEUP)
+{**
+ * The operation was incomplete although some processing was performed
+ * and the results are partially valid.
+ * @warning
+ * always use this test, as platform-specific variances may meet this
+ * more than one error code
+ *}
+//#define APR_STATUS_IS_INCOMPLETE(s)     ((s) == APR_INCOMPLETE)
+//* empty slot: +9 */
+//* empty slot: +10 */
+//* empty slot: +11 */
+{**
+ * Getopt found an option not in the option string
+ * @warning
+ * always use this test, as platform-specific variances may meet this
+ * more than one error code
+ *}
+//#define APR_STATUS_IS_BADCH(s)          ((s) == APR_BADCH)
+{**
+ * Getopt found an option not in the option string and an argument was
+ * specified in the option string
+ * @warning
+ * always use this test, as platform-specific variances may meet this
+ * more than one error code
+ *}
+//#define APR_STATUS_IS_BADARG(s)         ((s) == APR_BADARG)
+{**
+ * APR has encountered the end of the file
+ * @warning
+ * always use this test, as platform-specific variances may meet this
+ * more than one error code
+ *}
+//#define APR_STATUS_IS_EOF(s)            ((s) == APR_EOF)
+{**
+ * APR was unable to find the socket in the poll structure
+ * @warning
+ * always use this test, as platform-specific variances may meet this
+ * more than one error code
+ *}
+//#define APR_STATUS_IS_NOTFOUND(s)       ((s) == APR_NOTFOUND)
+//* empty slot: +16 */
+//* empty slot: +17 */
+//* empty slot: +18 */
+{**
+ * APR is using anonymous shared memory
+ * @warning
+ * always use this test, as platform-specific variances may meet this
+ * more than one error code
+ *}
+//#define APR_STATUS_IS_ANONYMOUS(s)      ((s) == APR_ANONYMOUS)
+{**
+ * APR is using a file name as the key to the shared memory
+ * @warning
+ * always use this test, as platform-specific variances may meet this
+ * more than one error code
+ *}
+//#define APR_STATUS_IS_FILEBASED(s)      ((s) == APR_FILEBASED)
+{**
+ * APR is using a shared key as the key to the shared memory
+ * @warning
+ * always use this test, as platform-specific variances may meet this
+ * more than one error code
+ *}
+//#define APR_STATUS_IS_KEYBASED(s)       ((s) == APR_KEYBASED)
+{**
+ * Ininitalizer value.  If no option has been found, but
+ * the status variable requires a value, this should be used
+ * @warning
+ * always use this test, as platform-specific variances may meet this
+ * more than one error code
+ *}
+//#define APR_STATUS_IS_EINIT(s)          ((s) == APR_EINIT)
+{**
+ * The APR function has not been implemented on this
+ * platform, either because nobody has gotten to it yet,
+ * or the function is impossible on this platform.
+ * @warning
+ * always use this test, as platform-specific variances may meet this
+ * more than one error code
+ *}
+//#define APR_STATUS_IS_ENOTIMPL(s)       ((s) == APR_ENOTIMPL)
+{**
+ * Two passwords do not match.
+ * @warning
+ * always use this test, as platform-specific variances may meet this
+ * more than one error code
+ *}
+//#define APR_STATUS_IS_EMISMATCH(s)      ((s) == APR_EMISMATCH)
+{**
+ * The given lock was busy
+ * @warning always use this test, as platform-specific variances may meet this
+ * more than one error code
+ *}
+//#define APR_STATUS_IS_EBUSY(s)          ((s) == APR_EBUSY)
+
+//** @} */
+
+(*
+/**
+ * @addtogroup APR_Error APR Error Values
+ * @{
+ */
+//* APR CANONICAL ERROR VALUES */
+//** @see APR_STATUS_IS_EACCES */
+#ifdef EACCES
+#define APR_EACCES EACCES
+#else
+#define APR_EACCES         (APR_OS_START_CANONERR + 1)
+#endif
+
+//** @see APR_STATUS_IS_EEXIST */
+#ifdef EEXIST
+#define APR_EEXIST EEXIST
+#else
+#define APR_EEXIST         (APR_OS_START_CANONERR + 2)
+#endif
+
+//** @see APR_STATUS_IS_ENAMETOOLONG */
+#ifdef ENAMETOOLONG
+#define APR_ENAMETOOLONG ENAMETOOLONG
+#else
+#define APR_ENAMETOOLONG   (APR_OS_START_CANONERR + 3)
+#endif
+
+//** @see APR_STATUS_IS_ENOENT */
+#ifdef ENOENT
+#define APR_ENOENT ENOENT
+#else
+#define APR_ENOENT         (APR_OS_START_CANONERR + 4)
+#endif
+
+//** @see APR_STATUS_IS_ENOTDIR */
+#ifdef ENOTDIR
+#define APR_ENOTDIR ENOTDIR
+#else
+#define APR_ENOTDIR        (APR_OS_START_CANONERR + 5)
+#endif
+
+//** @see APR_STATUS_IS_ENOSPC */
+#ifdef ENOSPC
+#define APR_ENOSPC ENOSPC
+#else
+#define APR_ENOSPC         (APR_OS_START_CANONERR + 6)
+#endif
+
+//** @see APR_STATUS_IS_ENOMEM */
+#ifdef ENOMEM
+#define APR_ENOMEM ENOMEM
+#else
+#define APR_ENOMEM         (APR_OS_START_CANONERR + 7)
+#endif
+
+//** @see APR_STATUS_IS_EMFILE */
+#ifdef EMFILE
+#define APR_EMFILE EMFILE
+#else
+#define APR_EMFILE         (APR_OS_START_CANONERR + 8)
+#endif
+
+//** @see APR_STATUS_IS_ENFILE */
+#ifdef ENFILE
+#define APR_ENFILE ENFILE
+#else
+#define APR_ENFILE         (APR_OS_START_CANONERR + 9)
+#endif
+
+//** @see APR_STATUS_IS_EBADF */
+#ifdef EBADF
+#define APR_EBADF EBADF
+#else
+#define APR_EBADF          (APR_OS_START_CANONERR + 10)
+#endif
+
+//** @see APR_STATUS_IS_EINVAL */
+#ifdef EINVAL
+#define APR_EINVAL EINVAL
+#else
+#define APR_EINVAL         (APR_OS_START_CANONERR + 11)
+#endif
+
+//** @see APR_STATUS_IS_ESPIPE */
+#ifdef ESPIPE
+#define APR_ESPIPE ESPIPE
+#else
+#define APR_ESPIPE         (APR_OS_START_CANONERR + 12)
+#endif
+
+{**
+ * @see APR_STATUS_IS_EAGAIN
+ * @warning use APR_STATUS_IS_EAGAIN instead of just testing this value
+ *}
+#ifdef EAGAIN
+#define APR_EAGAIN EAGAIN
+#elif defined(EWOULDBLOCK)
+#define APR_EAGAIN EWOULDBLOCK
+#else
+#define APR_EAGAIN         (APR_OS_START_CANONERR + 13)
+#endif
+
+//** @see APR_STATUS_IS_EINTR */
+#ifdef EINTR
+#define APR_EINTR EINTR
+#else
+#define APR_EINTR          (APR_OS_START_CANONERR + 14)
+#endif
+
+//** @see APR_STATUS_IS_ENOTSOCK */
+#ifdef ENOTSOCK
+#define APR_ENOTSOCK ENOTSOCK
+#else
+#define APR_ENOTSOCK       (APR_OS_START_CANONERR + 15)
+#endif
+
+//** @see APR_STATUS_IS_ECONNREFUSED */
+#ifdef ECONNREFUSED
+#define APR_ECONNREFUSED ECONNREFUSED
+#else
+#define APR_ECONNREFUSED   (APR_OS_START_CANONERR + 16)
+#endif
+
+//** @see APR_STATUS_IS_EINPROGRESS */
+#ifdef EINPROGRESS
+#define APR_EINPROGRESS EINPROGRESS
+#else
+#define APR_EINPROGRESS    (APR_OS_START_CANONERR + 17)
+#endif
+
+{**
+ * @see APR_STATUS_IS_ECONNABORTED
+ * @warning use APR_STATUS_IS_ECONNABORTED instead of just testing this value
+ *}
+
+#ifdef ECONNABORTED
+#define APR_ECONNABORTED ECONNABORTED
+#else
+#define APR_ECONNABORTED   (APR_OS_START_CANONERR + 18)
+#endif
+
+/** @see APR_STATUS_IS_ECONNRESET */
+#ifdef ECONNRESET
+#define APR_ECONNRESET ECONNRESET
+#else
+#define APR_ECONNRESET     (APR_OS_START_CANONERR + 19)
+#endif
+
+/** @see APR_STATUS_IS_ETIMEDOUT
+ *  @deprecated */
+#ifdef ETIMEDOUT
+#define APR_ETIMEDOUT ETIMEDOUT
+#else
+#define APR_ETIMEDOUT      (APR_OS_START_CANONERR + 20)
+#endif
+
+/** @see APR_STATUS_IS_EHOSTUNREACH */
+#ifdef EHOSTUNREACH
+#define APR_EHOSTUNREACH EHOSTUNREACH
+#else
+#define APR_EHOSTUNREACH   (APR_OS_START_CANONERR + 21)
+#endif
+
+/** @see APR_STATUS_IS_ENETUNREACH */
+#ifdef ENETUNREACH
+#define APR_ENETUNREACH ENETUNREACH
+#else
+#define APR_ENETUNREACH    (APR_OS_START_CANONERR + 22)
+#endif
+
+/** @see APR_STATUS_IS_EFTYPE */
+#ifdef EFTYPE
+#define APR_EFTYPE EFTYPE
+#else
+#define APR_EFTYPE        (APR_OS_START_CANONERR + 23)
+#endif
+
+/** @see APR_STATUS_IS_EPIPE */
+#ifdef EPIPE
+#define APR_EPIPE EPIPE
+#else
+#define APR_EPIPE         (APR_OS_START_CANONERR + 24)
+#endif
+
+/** @see APR_STATUS_IS_EXDEV */
+#ifdef EXDEV
+#define APR_EXDEV EXDEV
+#else
+#define APR_EXDEV         (APR_OS_START_CANONERR + 25)
+#endif
+
+/** @see APR_STATUS_IS_ENOTEMPTY */
+#ifdef ENOTEMPTY
+#define APR_ENOTEMPTY ENOTEMPTY
+#else
+#define APR_ENOTEMPTY     (APR_OS_START_CANONERR + 26)
+#endif
+
+/** @see APR_STATUS_IS_EAFNOSUPPORT */
+#ifdef EAFNOSUPPORT
+#define APR_EAFNOSUPPORT EAFNOSUPPORT
+#else
+#define APR_EAFNOSUPPORT  (APR_OS_START_CANONERR + 27)
+#endif
+
+/** @} */
+
+#if defined(OS2) && !defined(DOXYGEN)
+
+#define APR_FROM_OS_ERROR(e) (e == 0 ? APR_SUCCESS : e + APR_OS_START_SYSERR)
+#define APR_TO_OS_ERROR(e)   (e == 0 ? APR_SUCCESS : e - APR_OS_START_SYSERR)
+
+#define INCL_DOSERRORS
+#define INCL_DOS
+
+/* Leave these undefined.
+ * OS2 doesn't rely on the errno concept.
+ * The API calls always return a result codes which
+ * should be filtered through APR_FROM_OS_ERROR().
+ *
+ * #define apr_get_os_error()   (APR_FROM_OS_ERROR(GetLastError()))
+ * #define apr_set_os_error(e)  (SetLastError(APR_TO_OS_ERROR(e)))
+ */
+
+/* A special case, only socket calls require this;
+ */
+#define apr_get_netos_error()   (APR_FROM_OS_ERROR(errno))
+#define apr_set_netos_error(e)  (errno = APR_TO_OS_ERROR(e))
+
+/* And this needs to be greped away for good:
+ */
+#define APR_OS2_STATUS(e) (APR_FROM_OS_ERROR(e))
+*)
+{* These can't sit in a private header, so in spite of the extra size,
+ * they need to be made available here.
+ *}
+SOCBASEERR              = 10000;
+SOCEPERM                = (SOCBASEERR + 1);             //* Not owner */
+SOCESRCH                = (SOCBASEERR + 3);             //* No such process */
+SOCEINTR                = (SOCBASEERR + 4);             //* Interrupted system call */
+SOCENXIO                = (SOCBASEERR + 6);             //* No such device or address */
+SOCEBADF                = (SOCBASEERR + 9);             //* Bad file number */
+SOCEACCES               = (SOCBASEERR + 13);            //* Permission denied */
+SOCEFAULT               = (SOCBASEERR + 14);            //* Bad address */
+SOCEINVAL               = (SOCBASEERR + 22);            //* Invalid argument */
+SOCEMFILE               = (SOCBASEERR + 24);            //* Too many open files */
+SOCEPIPE                = (SOCBASEERR + 32);            //* Broken pipe */
+SOCEOS2ERR              = (SOCBASEERR + 100);           //* OS/2 Error */
+SOCEWOULDBLOCK          = (SOCBASEERR + 35);            //* Operation would block */
+SOCEINPROGRESS          = (SOCBASEERR + 36);            //* Operation now in progress */
+SOCEALREADY             = (SOCBASEERR + 37);            //* Operation already in progress */
+SOCENOTSOCK             = (SOCBASEERR + 38);            //* Socket operation on non-socket */
+SOCEDESTADDRREQ         = (SOCBASEERR + 39);            //* Destination address required */
+SOCEMSGSIZE             = (SOCBASEERR + 40);            //* Message too long */
+SOCEPROTOTYPE           = (SOCBASEERR + 41);            //* Protocol wrong type for socket */
+SOCENOPROTOOPT          = (SOCBASEERR + 42);            //* Protocol not available */
+SOCEPROTONOSUPPORT      = (SOCBASEERR + 43);            //* Protocol not supported */
+SOCESOCKTNOSUPPORT      = (SOCBASEERR + 44);            //* Socket type not supported */
+SOCEOPNOTSUPP           = (SOCBASEERR + 45);            //* Operation not supported on socket */
+SOCEPFNOSUPPORT         = (SOCBASEERR + 46);            //* Protocol family not supported */
+SOCEAFNOSUPPORT         = (SOCBASEERR + 47);            //* Address family not supported by protocol family */
+SOCEADDRINUSE           = (SOCBASEERR + 48);            //* Address already in use */
+SOCEADDRNOTAVAIL        = (SOCBASEERR + 49);            //* Can't assign requested address */
+SOCENETDOWN             = (SOCBASEERR + 50);            //* Network is down */
+SOCENETUNREACH          = (SOCBASEERR + 51);            //* Network is unreachable */
+SOCENETRESET            = (SOCBASEERR + 52);            //* Network dropped connection on reset */
+SOCECONNABORTED         = (SOCBASEERR + 53);            //* Software caused connection abort */
+SOCECONNRESET           = (SOCBASEERR + 54);            //* Connection reset by peer */
+SOCENOBUFS              = (SOCBASEERR + 55);            //* No buffer space available */
+SOCEISCONN              = (SOCBASEERR + 56);            //* Socket is already connected */
+SOCENOTCONN             = (SOCBASEERR + 57);            //* Socket is not connected */
+SOCESHUTDOWN            = (SOCBASEERR + 58);            //* Can't send after socket shutdown */
+SOCETOOMANYREFS         = (SOCBASEERR + 59);            //* Too many references: can't splice */
+SOCETIMEDOUT            = (SOCBASEERR + 60);            //* Connection timed out */
+SOCECONNREFUSED         = (SOCBASEERR + 61);            //* Connection refused */
+SOCELOOP                = (SOCBASEERR + 62);            //* Too many levels of symbolic links */
+SOCENAMETOOLONG         = (SOCBASEERR + 63);            //* File name too long */
+SOCEHOSTDOWN            = (SOCBASEERR + 64);            //* Host is down */
+SOCEHOSTUNREACH         = (SOCBASEERR + 65);            //* No route to host */
+SOCENOTEMPTY            = (SOCBASEERR + 66);            //* Directory not empty */
+(*
+/* APR CANONICAL ERROR TESTS */
+#define APR_STATUS_IS_EACCES(s)         ((s) == APR_EACCES \
+                || (s) == APR_OS_START_SYSERR + ERROR_ACCESS_DENIED \
+                || (s) == APR_OS_START_SYSERR + ERROR_SHARING_VIOLATION)
+#define APR_STATUS_IS_EEXIST(s)         ((s) == APR_EEXIST \
+                || (s) == APR_OS_START_SYSERR + ERROR_OPEN_FAILED \
+                || (s) == APR_OS_START_SYSERR + ERROR_FILE_EXISTS \
+                || (s) == APR_OS_START_SYSERR + ERROR_ALREADY_EXISTS \
+                || (s) == APR_OS_START_SYSERR + ERROR_ACCESS_DENIED)
+#define APR_STATUS_IS_ENAMETOOLONG(s)   ((s) == APR_ENAMETOOLONG \
+                || (s) == APR_OS_START_SYSERR + ERROR_FILENAME_EXCED_RANGE \
+                || (s) == APR_OS_START_SYSERR + SOCENAMETOOLONG)
+#define APR_STATUS_IS_ENOENT(s)         ((s) == APR_ENOENT \
+                || (s) == APR_OS_START_SYSERR + ERROR_FILE_NOT_FOUND \
+                || (s) == APR_OS_START_SYSERR + ERROR_PATH_NOT_FOUND \
+                || (s) == APR_OS_START_SYSERR + ERROR_NO_MORE_FILES \
+                || (s) == APR_OS_START_SYSERR + ERROR_OPEN_FAILED)
+#define APR_STATUS_IS_ENOTDIR(s)        ((s) == APR_ENOTDIR)
+#define APR_STATUS_IS_ENOSPC(s)         ((s) == APR_ENOSPC \
+                || (s) == APR_OS_START_SYSERR + ERROR_DISK_FULL)
+#define APR_STATUS_IS_ENOMEM(s)         ((s) == APR_ENOMEM)
+#define APR_STATUS_IS_EMFILE(s)         ((s) == APR_EMFILE \
+                || (s) == APR_OS_START_SYSERR + ERROR_TOO_MANY_OPEN_FILES)
+#define APR_STATUS_IS_ENFILE(s)         ((s) == APR_ENFILE)
+#define APR_STATUS_IS_EBADF(s)          ((s) == APR_EBADF \
+                || (s) == APR_OS_START_SYSERR + ERROR_INVALID_HANDLE)
+#define APR_STATUS_IS_EINVAL(s)         ((s) == APR_EINVAL \
+                || (s) == APR_OS_START_SYSERR + ERROR_INVALID_PARAMETER \
+                || (s) == APR_OS_START_SYSERR + ERROR_INVALID_FUNCTION)
+#define APR_STATUS_IS_ESPIPE(s)         ((s) == APR_ESPIPE \
+                || (s) == APR_OS_START_SYSERR + ERROR_NEGATIVE_SEEK)
+#define APR_STATUS_IS_EAGAIN(s)         ((s) == APR_EAGAIN \
+                || (s) == APR_OS_START_SYSERR + ERROR_NO_DATA \
+                || (s) == APR_OS_START_SYSERR + SOCEWOULDBLOCK \
+                || (s) == APR_OS_START_SYSERR + ERROR_LOCK_VIOLATION)
+#define APR_STATUS_IS_EINTR(s)          ((s) == APR_EINTR \
+                || (s) == APR_OS_START_SYSERR + SOCEINTR)
+#define APR_STATUS_IS_ENOTSOCK(s)       ((s) == APR_ENOTSOCK \
+                || (s) == APR_OS_START_SYSERR + SOCENOTSOCK)
+#define APR_STATUS_IS_ECONNREFUSED(s)   ((s) == APR_ECONNREFUSED \
+                || (s) == APR_OS_START_SYSERR + SOCECONNREFUSED)
+#define APR_STATUS_IS_EINPROGRESS(s)    ((s) == APR_EINPROGRESS \
+                || (s) == APR_OS_START_SYSERR + SOCEINPROGRESS)
+#define APR_STATUS_IS_ECONNABORTED(s)   ((s) == APR_ECONNABORTED \
+                || (s) == APR_OS_START_SYSERR + SOCECONNABORTED)
+#define APR_STATUS_IS_ECONNRESET(s)     ((s) == APR_ECONNRESET \
+                || (s) == APR_OS_START_SYSERR + SOCECONNRESET)
+/* XXX deprecated */
+#define APR_STATUS_IS_ETIMEDOUT(s)         ((s) == APR_ETIMEDOUT \
+                || (s) == APR_OS_START_SYSERR + SOCETIMEDOUT)
+#undef APR_STATUS_IS_TIMEUP
+#define APR_STATUS_IS_TIMEUP(s)         ((s) == APR_TIMEUP \
+                || (s) == APR_OS_START_SYSERR + SOCETIMEDOUT)
+#define APR_STATUS_IS_EHOSTUNREACH(s)   ((s) == APR_EHOSTUNREACH \
+                || (s) == APR_OS_START_SYSERR + SOCEHOSTUNREACH)
+#define APR_STATUS_IS_ENETUNREACH(s)    ((s) == APR_ENETUNREACH \
+                || (s) == APR_OS_START_SYSERR + SOCENETUNREACH)
+#define APR_STATUS_IS_EFTYPE(s)         ((s) == APR_EFTYPE)
+#define APR_STATUS_IS_EPIPE(s)          ((s) == APR_EPIPE \
+                || (s) == APR_OS_START_SYSERR + ERROR_BROKEN_PIPE \
+                || (s) == APR_OS_START_SYSERR + SOCEPIPE)
+#define APR_STATUS_IS_EXDEV(s)          ((s) == APR_EXDEV \
+                || (s) == APR_OS_START_SYSERR + ERROR_NOT_SAME_DEVICE)
+#define APR_STATUS_IS_ENOTEMPTY(s)      ((s) == APR_ENOTEMPTY \
+                || (s) == APR_OS_START_SYSERR + ERROR_DIR_NOT_EMPTY \
+                || (s) == APR_OS_START_SYSERR + ERROR_ACCESS_DENIED)
+#define APR_STATUS_IS_EAFNOSUPPORT(s)   ((s) == APR_AFNOSUPPORT \
+                || (s) == APR_OS_START_SYSERR + SOCEAFNOSUPPORT)
+
+/*
+    Sorry, too tired to wrap this up for OS2... feel free to
+    fit the following into their best matches.
+
+    { ERROR_NO_SIGNAL_SENT,     ESRCH           },
+    { SOCEALREADY,              EALREADY        },
+    { SOCEDESTADDRREQ,          EDESTADDRREQ    },
+    { SOCEMSGSIZE,              EMSGSIZE        },
+    { SOCEPROTOTYPE,            EPROTOTYPE      },
+    { SOCENOPROTOOPT,           ENOPROTOOPT     },
+    { SOCEPROTONOSUPPORT,       EPROTONOSUPPORT },
+    { SOCESOCKTNOSUPPORT,       ESOCKTNOSUPPORT },
+    { SOCEOPNOTSUPP,            EOPNOTSUPP      },
+    { SOCEPFNOSUPPORT,          EPFNOSUPPORT    },
+    { SOCEADDRINUSE,            EADDRINUSE      },
+    { SOCEADDRNOTAVAIL,         EADDRNOTAVAIL   },
+    { SOCENETDOWN,              ENETDOWN        },
+    { SOCENETRESET,             ENETRESET       },
+    { SOCENOBUFS,               ENOBUFS         },
+    { SOCEISCONN,               EISCONN         },
+    { SOCENOTCONN,              ENOTCONN        },
+    { SOCESHUTDOWN,             ESHUTDOWN       },
+    { SOCETOOMANYREFS,          ETOOMANYREFS    },
+    { SOCELOOP,                 ELOOP           },
+    { SOCEHOSTDOWN,             EHOSTDOWN       },
+    { SOCENOTEMPTY,             ENOTEMPTY       },
+    { SOCEPIPE,                 EPIPE           }
+*/
+
+#elif defined(WIN32) && !defined(DOXYGEN) /* !defined(OS2) */
+
+#define APR_FROM_OS_ERROR(e) (e == 0 ? APR_SUCCESS : e + APR_OS_START_SYSERR)
+#define APR_TO_OS_ERROR(e)   (e == 0 ? APR_SUCCESS : e - APR_OS_START_SYSERR)
+
+#define apr_get_os_error()   (APR_FROM_OS_ERROR(GetLastError()))
+#define apr_set_os_error(e)  (SetLastError(APR_TO_OS_ERROR(e)))
+
+/* A special case, only socket calls require this:
+ */
+#define apr_get_netos_error()   (APR_FROM_OS_ERROR(WSAGetLastError()))
+#define apr_set_netos_error(e)   (WSASetLastError(APR_TO_OS_ERROR(e)))
+
+/* APR CANONICAL ERROR TESTS */
+#define APR_STATUS_IS_EACCES(s)         ((s) == APR_EACCES \
+                || (s) == APR_OS_START_SYSERR + ERROR_ACCESS_DENIED \
+                || (s) == APR_OS_START_SYSERR + ERROR_CANNOT_MAKE \
+                || (s) == APR_OS_START_SYSERR + ERROR_CURRENT_DIRECTORY \
+                || (s) == APR_OS_START_SYSERR + ERROR_DRIVE_LOCKED \
+                || (s) == APR_OS_START_SYSERR + ERROR_FAIL_I24 \
+                || (s) == APR_OS_START_SYSERR + ERROR_LOCK_VIOLATION \
+                || (s) == APR_OS_START_SYSERR + ERROR_LOCK_FAILED \
+                || (s) == APR_OS_START_SYSERR + ERROR_NOT_LOCKED \
+                || (s) == APR_OS_START_SYSERR + ERROR_NETWORK_ACCESS_DENIED \
+                || (s) == APR_OS_START_SYSERR + ERROR_SHARING_VIOLATION)
+#define APR_STATUS_IS_EEXIST(s)         ((s) == APR_EEXIST \
+                || (s) == APR_OS_START_SYSERR + ERROR_FILE_EXISTS \
+                || (s) == APR_OS_START_SYSERR + ERROR_ALREADY_EXISTS)
+#define APR_STATUS_IS_ENAMETOOLONG(s)   ((s) == APR_ENAMETOOLONG \
+                || (s) == APR_OS_START_SYSERR + ERROR_FILENAME_EXCED_RANGE \
+                || (s) == APR_OS_START_SYSERR + WSAENAMETOOLONG)
+#define APR_STATUS_IS_ENOENT(s)         ((s) == APR_ENOENT \
+                || (s) == APR_OS_START_SYSERR + ERROR_FILE_NOT_FOUND \
+                || (s) == APR_OS_START_SYSERR + ERROR_PATH_NOT_FOUND \
+                || (s) == APR_OS_START_SYSERR + ERROR_OPEN_FAILED \
+                || (s) == APR_OS_START_SYSERR + ERROR_NO_MORE_FILES)
+#define APR_STATUS_IS_ENOTDIR(s)        ((s) == APR_ENOTDIR \
+                || (s) == APR_OS_START_SYSERR + ERROR_PATH_NOT_FOUND \
+                || (s) == APR_OS_START_SYSERR + ERROR_BAD_NETPATH \
+                || (s) == APR_OS_START_SYSERR + ERROR_BAD_NET_NAME \
+                || (s) == APR_OS_START_SYSERR + ERROR_BAD_PATHNAME \
+                || (s) == APR_OS_START_SYSERR + ERROR_INVALID_DRIVE \
+                || (s) == APR_OS_START_SYSERR + ERROR_DIRECTORY)
+#define APR_STATUS_IS_ENOSPC(s)         ((s) == APR_ENOSPC \
+                || (s) == APR_OS_START_SYSERR + ERROR_DISK_FULL)
+#define APR_STATUS_IS_ENOMEM(s)         ((s) == APR_ENOMEM \
+                || (s) == APR_OS_START_SYSERR + ERROR_ARENA_TRASHED \
+                || (s) == APR_OS_START_SYSERR + ERROR_NOT_ENOUGH_MEMORY \
+                || (s) == APR_OS_START_SYSERR + ERROR_INVALID_BLOCK \
+                || (s) == APR_OS_START_SYSERR + ERROR_NOT_ENOUGH_QUOTA \
+                || (s) == APR_OS_START_SYSERR + ERROR_OUTOFMEMORY)
+#define APR_STATUS_IS_EMFILE(s)         ((s) == APR_EMFILE \
+                || (s) == APR_OS_START_SYSERR + ERROR_TOO_MANY_OPEN_FILES)
+#define APR_STATUS_IS_ENFILE(s)         ((s) == APR_ENFILE)
+#define APR_STATUS_IS_EBADF(s)          ((s) == APR_EBADF \
+                || (s) == APR_OS_START_SYSERR + ERROR_INVALID_HANDLE \
+                || (s) == APR_OS_START_SYSERR + ERROR_INVALID_TARGET_HANDLE)
+#define APR_STATUS_IS_EINVAL(s)         ((s) == APR_EINVAL \
+                || (s) == APR_OS_START_SYSERR + ERROR_INVALID_ACCESS \
+                || (s) == APR_OS_START_SYSERR + ERROR_INVALID_DATA \
+                || (s) == APR_OS_START_SYSERR + ERROR_INVALID_FUNCTION \
+                || (s) == APR_OS_START_SYSERR + ERROR_INVALID_HANDLE \
+                || (s) == APR_OS_START_SYSERR + ERROR_INVALID_PARAMETER \
+                || (s) == APR_OS_START_SYSERR + ERROR_NEGATIVE_SEEK)
+#define APR_STATUS_IS_ESPIPE(s)         ((s) == APR_ESPIPE \
+                || (s) == APR_OS_START_SYSERR + ERROR_SEEK_ON_DEVICE \
+                || (s) == APR_OS_START_SYSERR + ERROR_NEGATIVE_SEEK)
+#define APR_STATUS_IS_EAGAIN(s)         ((s) == APR_EAGAIN \
+                || (s) == APR_OS_START_SYSERR + ERROR_NO_DATA \
+                || (s) == APR_OS_START_SYSERR + ERROR_NO_PROC_SLOTS \
+                || (s) == APR_OS_START_SYSERR + ERROR_NESTING_NOT_ALLOWED \
+                || (s) == APR_OS_START_SYSERR + ERROR_MAX_THRDS_REACHED \
+                || (s) == APR_OS_START_SYSERR + ERROR_LOCK_VIOLATION \
+                || (s) == APR_OS_START_SYSERR + WSAEWOULDBLOCK)
+#define APR_STATUS_IS_EINTR(s)          ((s) == APR_EINTR \
+                || (s) == APR_OS_START_SYSERR + WSAEINTR)
+#define APR_STATUS_IS_ENOTSOCK(s)       ((s) == APR_ENOTSOCK \
+                || (s) == APR_OS_START_SYSERR + WSAENOTSOCK)
+#define APR_STATUS_IS_ECONNREFUSED(s)   ((s) == APR_ECONNREFUSED \
+                || (s) == APR_OS_START_SYSERR + WSAECONNREFUSED)
+#define APR_STATUS_IS_EINPROGRESS(s)    ((s) == APR_EINPROGRESS \
+                || (s) == APR_OS_START_SYSERR + WSAEINPROGRESS)
+#define APR_STATUS_IS_ECONNABORTED(s)   ((s) == APR_ECONNABORTED \
+                || (s) == APR_OS_START_SYSERR + WSAECONNABORTED)
+#define APR_STATUS_IS_ECONNRESET(s)     ((s) == APR_ECONNRESET \
+                || (s) == APR_OS_START_SYSERR + ERROR_NETNAME_DELETED \
+                || (s) == APR_OS_START_SYSERR + WSAECONNRESET)
+/* XXX deprecated */
+#define APR_STATUS_IS_ETIMEDOUT(s)         ((s) == APR_ETIMEDOUT \
+                || (s) == APR_OS_START_SYSERR + WSAETIMEDOUT \
+                || (s) == APR_OS_START_SYSERR + WAIT_TIMEOUT)
+#undef APR_STATUS_IS_TIMEUP
+#define APR_STATUS_IS_TIMEUP(s)         ((s) == APR_TIMEUP \
+                || (s) == APR_OS_START_SYSERR + WSAETIMEDOUT \
+                || (s) == APR_OS_START_SYSERR + WAIT_TIMEOUT)
+#define APR_STATUS_IS_EHOSTUNREACH(s)   ((s) == APR_EHOSTUNREACH \
+                || (s) == APR_OS_START_SYSERR + WSAEHOSTUNREACH)
+#define APR_STATUS_IS_ENETUNREACH(s)    ((s) == APR_ENETUNREACH \
+                || (s) == APR_OS_START_SYSERR + WSAENETUNREACH)
+#define APR_STATUS_IS_EFTYPE(s)         ((s) == APR_EFTYPE \
+                || (s) == APR_OS_START_SYSERR + ERROR_EXE_MACHINE_TYPE_MISMATCH \
+                || (s) == APR_OS_START_SYSERR + ERROR_INVALID_DLL \
+                || (s) == APR_OS_START_SYSERR + ERROR_INVALID_MODULETYPE \
+                || (s) == APR_OS_START_SYSERR + ERROR_BAD_EXE_FORMAT \
+                || (s) == APR_OS_START_SYSERR + ERROR_INVALID_EXE_SIGNATURE \
+                || (s) == APR_OS_START_SYSERR + ERROR_FILE_CORRUPT \
+                || (s) == APR_OS_START_SYSERR + ERROR_BAD_FORMAT)
+#define APR_STATUS_IS_EPIPE(s)          ((s) == APR_EPIPE \
+                || (s) == APR_OS_START_SYSERR + ERROR_BROKEN_PIPE)
+#define APR_STATUS_IS_EXDEV(s)          ((s) == APR_EXDEV \
+                || (s) == APR_OS_START_SYSERR + ERROR_NOT_SAME_DEVICE)
+#define APR_STATUS_IS_ENOTEMPTY(s)      ((s) == APR_ENOTEMPTY \
+                || (s) == APR_OS_START_SYSERR + ERROR_DIR_NOT_EMPTY)
+#define APR_STATUS_IS_EAFNOSUPPORT(s)   ((s) == APR_EAFNOSUPPORT \
+                || (s) == APR_OS_START_SYSERR + WSAEAFNOSUPPORT)
+
+#elif defined(NETWARE) && defined(USE_WINSOCK) && !defined(DOXYGEN) /* !defined(OS2) && !defined(WIN32) */
+
+#define APR_FROM_OS_ERROR(e) (e == 0 ? APR_SUCCESS : e + APR_OS_START_SYSERR)
+#define APR_TO_OS_ERROR(e)   (e == 0 ? APR_SUCCESS : e - APR_OS_START_SYSERR)
+
+#define apr_get_os_error()    (errno)
+#define apr_set_os_error(e)   (errno = (e))
+
+/* A special case, only socket calls require this: */
+#define apr_get_netos_error()   (APR_FROM_OS_ERROR(WSAGetLastError()))
+#define apr_set_netos_error(e)  (WSASetLastError(APR_TO_OS_ERROR(e)))
+
+/* APR CANONICAL ERROR TESTS */
+#define APR_STATUS_IS_EACCES(s)         ((s) == APR_EACCES)
+#define APR_STATUS_IS_EEXIST(s)         ((s) == APR_EEXIST)
+#define APR_STATUS_IS_ENAMETOOLONG(s)   ((s) == APR_ENAMETOOLONG)
+#define APR_STATUS_IS_ENOENT(s)         ((s) == APR_ENOENT)
+#define APR_STATUS_IS_ENOTDIR(s)        ((s) == APR_ENOTDIR)
+#define APR_STATUS_IS_ENOSPC(s)         ((s) == APR_ENOSPC)
+#define APR_STATUS_IS_ENOMEM(s)         ((s) == APR_ENOMEM)
+#define APR_STATUS_IS_EMFILE(s)         ((s) == APR_EMFILE)
+#define APR_STATUS_IS_ENFILE(s)         ((s) == APR_ENFILE)
+#define APR_STATUS_IS_EBADF(s)          ((s) == APR_EBADF)
+#define APR_STATUS_IS_EINVAL(s)         ((s) == APR_EINVAL)
+#define APR_STATUS_IS_ESPIPE(s)         ((s) == APR_ESPIPE)
+
+#define APR_STATUS_IS_EAGAIN(s)         ((s) == APR_EAGAIN \
+                || (s) ==                       EWOULDBLOCK \
+                || (s) == APR_OS_START_SYSERR + WSAEWOULDBLOCK)
+#define APR_STATUS_IS_EINTR(s)          ((s) == APR_EINTR \
+                || (s) == APR_OS_START_SYSERR + WSAEINTR)
+#define APR_STATUS_IS_ENOTSOCK(s)       ((s) == APR_ENOTSOCK \
+                || (s) == APR_OS_START_SYSERR + WSAENOTSOCK)
+#define APR_STATUS_IS_ECONNREFUSED(s)   ((s) == APR_ECONNREFUSED \
+                || (s) == APR_OS_START_SYSERR + WSAECONNREFUSED)
+#define APR_STATUS_IS_EINPROGRESS(s)    ((s) == APR_EINPROGRESS \
+                || (s) == APR_OS_START_SYSERR + WSAEINPROGRESS)
+#define APR_STATUS_IS_ECONNABORTED(s)   ((s) == APR_ECONNABORTED \
+                || (s) == APR_OS_START_SYSERR + WSAECONNABORTED)
+#define APR_STATUS_IS_ECONNRESET(s)     ((s) == APR_ECONNRESET \
+                || (s) == APR_OS_START_SYSERR + WSAECONNRESET)
+/* XXX deprecated */
+#define APR_STATUS_IS_ETIMEDOUT(s)       ((s) == APR_ETIMEDOUT \
+                || (s) == APR_OS_START_SYSERR + WSAETIMEDOUT \
+                || (s) == APR_OS_START_SYSERR + WAIT_TIMEOUT)
+#undef APR_STATUS_IS_TIMEUP
+#define APR_STATUS_IS_TIMEUP(s)         ((s) == APR_TIMEUP \
+                || (s) == APR_OS_START_SYSERR + WSAETIMEDOUT \
+                || (s) == APR_OS_START_SYSERR + WAIT_TIMEOUT)
+#define APR_STATUS_IS_EHOSTUNREACH(s)   ((s) == APR_EHOSTUNREACH \
+                || (s) == APR_OS_START_SYSERR + WSAEHOSTUNREACH)
+#define APR_STATUS_IS_ENETUNREACH(s)    ((s) == APR_ENETUNREACH \
+                || (s) == APR_OS_START_SYSERR + WSAENETUNREACH)
+#define APR_STATUS_IS_ENETDOWN(s)       ((s) == APR_OS_START_SYSERR + WSAENETDOWN)
+#define APR_STATUS_IS_EFTYPE(s)         ((s) == APR_EFTYPE)
+#define APR_STATUS_IS_EPIPE(s)          ((s) == APR_EPIPE)
+#define APR_STATUS_IS_EXDEV(s)          ((s) == APR_EXDEV)
+#define APR_STATUS_IS_ENOTEMPTY(s)      ((s) == APR_ENOTEMPTY)
+#define APR_STATUS_IS_EAFNOSUPPORT(s)   ((s) == APR_EAFNOSUPPORT \
+                || (s) == APR_OS_START_SYSERR + WSAEAFNOSUPPORT)
+
+#else /* !defined(NETWARE) && !defined(OS2) && !defined(WIN32) */
+
+/*
+ *  os error codes are clib error codes
+ */
+#define APR_FROM_OS_ERROR(e)  (e)
+#define APR_TO_OS_ERROR(e)    (e)
+
+#define apr_get_os_error()    (errno)
+#define apr_set_os_error(e)   (errno = (e))
+
+/* A special case, only socket calls require this:
+ */
+#define apr_get_netos_error() (errno)
+#define apr_set_netos_error(e) (errno = (e))
+
+/**
+ * @addtogroup APR_STATUS_IS
+ * @{
+ */
+
+/** permission denied */
+#define APR_STATUS_IS_EACCES(s)         ((s) == APR_EACCES)
+/** file exists */
+#define APR_STATUS_IS_EEXIST(s)         ((s) == APR_EEXIST)
+/** path name is too long */
+#define APR_STATUS_IS_ENAMETOOLONG(s)   ((s) == APR_ENAMETOOLONG)
+/**
+ * no such file or directory
+ * @remark
+ * EMVSCATLG can be returned by the automounter on z/OS for
+ * paths which do not exist.
+ */
+#ifdef EMVSCATLG
+#define APR_STATUS_IS_ENOENT(s)         ((s) == APR_ENOENT \
+                                      || (s) == EMVSCATLG)
+#else
+#define APR_STATUS_IS_ENOENT(s)         ((s) == APR_ENOENT)
+#endif
+/** not a directory */
+#define APR_STATUS_IS_ENOTDIR(s)        ((s) == APR_ENOTDIR)
+/** no space left on device */
+#ifdef EDQUOT
+#define APR_STATUS_IS_ENOSPC(s)         ((s) == APR_ENOSPC \
+                                      || (s) == EDQUOT)
+#else
+#define APR_STATUS_IS_ENOSPC(s)         ((s) == APR_ENOSPC)
+#endif
+/** not enough memory */
+#define APR_STATUS_IS_ENOMEM(s)         ((s) == APR_ENOMEM)
+/** too many open files */
+#define APR_STATUS_IS_EMFILE(s)         ((s) == APR_EMFILE)
+/** file table overflow */
+#define APR_STATUS_IS_ENFILE(s)         ((s) == APR_ENFILE)
+/** bad file # */
+#define APR_STATUS_IS_EBADF(s)          ((s) == APR_EBADF)
+/** invalid argument */
+#define APR_STATUS_IS_EINVAL(s)         ((s) == APR_EINVAL)
+/** illegal seek */
+#define APR_STATUS_IS_ESPIPE(s)         ((s) == APR_ESPIPE)
+
+/** operation would block */
+#if !defined(EWOULDBLOCK) || !defined(EAGAIN)
+#define APR_STATUS_IS_EAGAIN(s)         ((s) == APR_EAGAIN)
+#elif (EWOULDBLOCK == EAGAIN)
+#define APR_STATUS_IS_EAGAIN(s)         ((s) == APR_EAGAIN)
+#else
+#define APR_STATUS_IS_EAGAIN(s)         ((s) == APR_EAGAIN \
+                                      || (s) == EWOULDBLOCK)
+#endif
+
+/** interrupted system call */
+#define APR_STATUS_IS_EINTR(s)          ((s) == APR_EINTR)
+/** socket operation on a non-socket */
+#define APR_STATUS_IS_ENOTSOCK(s)       ((s) == APR_ENOTSOCK)
+/** Connection Refused */
+#define APR_STATUS_IS_ECONNREFUSED(s)   ((s) == APR_ECONNREFUSED)
+/** operation now in progress */
+#define APR_STATUS_IS_EINPROGRESS(s)    ((s) == APR_EINPROGRESS)
+
+/**
+ * Software caused connection abort
+ * @remark
+ * EPROTO on certain older kernels really means ECONNABORTED, so we need to
+ * ignore it for them.  See discussion in new-httpd archives nh.9701 & nh.9603
+ *
+ * There is potentially a bug in Solaris 2.x x<6, and other boxes that
+ * implement tcp sockets in userland (i.e. on top of STREAMS).  On these
+ * systems, EPROTO can actually result in a fatal loop.  See PR#981 for
+ * example.  It's hard to handle both uses of EPROTO.
+ */
+#ifdef EPROTO
+#define APR_STATUS_IS_ECONNABORTED(s)    ((s) == APR_ECONNABORTED \
+                                       || (s) == EPROTO)
+#else
+#define APR_STATUS_IS_ECONNABORTED(s)    ((s) == APR_ECONNABORTED)
+#endif
+
+/** Connection Reset by peer */
+#define APR_STATUS_IS_ECONNRESET(s)      ((s) == APR_ECONNRESET)
+/** Operation timed out
+ *  @deprecated */
+#define APR_STATUS_IS_ETIMEDOUT(s)      ((s) == APR_ETIMEDOUT)
+/** no route to host */
+#define APR_STATUS_IS_EHOSTUNREACH(s)    ((s) == APR_EHOSTUNREACH)
+/** network is unreachable */
+#define APR_STATUS_IS_ENETUNREACH(s)     ((s) == APR_ENETUNREACH)
+/** inappropiate file type or format */
+#define APR_STATUS_IS_EFTYPE(s)          ((s) == APR_EFTYPE)
+/** broken pipe */
+#define APR_STATUS_IS_EPIPE(s)           ((s) == APR_EPIPE)
+/** cross device link */
+#define APR_STATUS_IS_EXDEV(s)           ((s) == APR_EXDEV)
+/** Directory Not Empty */
+#define APR_STATUS_IS_ENOTEMPTY(s)       ((s) == APR_ENOTEMPTY || \
+                                          (s) == APR_EEXIST)
+/** Address Family not supported */
+#define APR_STATUS_IS_EAFNOSUPPORT(s)    ((s) == APR_EAFNOSUPPORT)
+/** @} */
+
+#endif /* !defined(NETWARE) && !defined(OS2) && !defined(WIN32) */
+*)
+(** @} *)
+
+{$endif}  //* ! APR_ERRNO_H */

+ 488 - 0
packages/httpd24/src/apr/apr_file_info.inc

@@ -0,0 +1,488 @@
+{* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *}
+
+//#ifndef APR_FILE_INFO_H
+//#define APR_FILE_INFO_H
+
+{**
+ * @file apr_file_info.h
+ * @brief APR File Information
+ *}
+
+//#include "apr.h"
+//#include "apr_user.h"
+//#include "apr_pools.h"
+//#include "apr_tables.h"
+//#include "apr_time.h"
+//#include "apr_errno.h"
+
+//#if APR_HAVE_SYS_UIO_H
+//#include <sys/uio.h>
+//#endif
+
+(**
+ * @defgroup apr_file_info File Information
+ * @ingroup APR 
+ * @{
+ *)
+
+{* Many applications use the type member to determine the
+ * existance of a file or initialization of the file info,
+ * so the APR_NOFILE value must be distinct from APR_UNKFILE.
+ *}
+
+{** apr_filetype_e values for the filetype member of the
+ * apr_file_info_t structure
+ * @warning: Not all of the filetypes below can be determined.
+ * For example, a given platform might not correctly report 
+ * a socket descriptor as APR_SOCK if that type isn't 
+ * well-identified on that platform.  In such cases where
+ * a filetype exists but cannot be described by the recognized
+ * flags below, the filetype will be APR_UNKFILE.  If the
+ * filetype member is not determined, the type will be APR_NOFILE.
+ *}
+type
+  apr_filetype_e = (
+    APR_NOFILE = 0,     {*< no file type determined }
+    APR_REG,            {*< a regular file }
+    APR_DIR,            {*< a directory }
+    APR_CHR,            {*< a character device }
+    APR_BLK,            {*< a block device }
+    APR_PIPE,           {*< a FIFO / pipe }
+    APR_LNK,            {*< a symbolic link }
+    APR_SOCK,           {*< a [unix domain] socket }
+    APR_UNKFILE = 127   {*< a file of some other unknown type }
+  );
+
+(**
+ * @defgroup apr_file_permissions File Permissions flags 
+ * @{
+ *)
+const
+  APR_FPROT_USETID      = $8000; //**< Set user id */
+  APR_FPROT_UREAD       = $0400; //**< Read by user */
+  APR_FPROT_UWRITE      = $0200; //**< Write by user */
+  APR_FPROT_UEXECUTE    = $0100; //**< Execute by user */
+
+  APR_FPROT_GSETID      = $4000; //**< Set group id */
+  APR_FPROT_GREAD       = $0040; //**< Read by group */
+  APR_FPROT_GWRITE      = $0020; //**< Write by group */
+  APR_FPROT_GEXECUTE    = $0010; //**< Execute by group */
+
+  APR_FPROT_WSTICKY     = $2000; //**< Sticky bit */
+  APR_FPROT_WREAD       = $0004; //**< Read by others */
+  APR_FPROT_WWRITE      = $0002; //**< Write by others */
+  APR_FPROT_WEXECUTE    = $0001; //**< Execute by others */
+
+  APR_FPROT_OS_DEFAULT  = $0FFF; //**< use OS's default permissions */
+
+//* additional permission flags for apr_file_copy  and apr_file_append */
+  APR_FPROT_FILE_SOURCE_PERMS = $1000; //**< Copy source file's permissions */
+    
+//* backcompat */
+  APR_USETID            = APR_FPROT_USETID;             //**< @deprecated @see APR_FPROT_USETID     */
+  APR_UREAD             = APR_FPROT_UREAD;              //**< @deprecated @see APR_FPROT_UREAD      */
+  APR_UWRITE            = APR_FPROT_UWRITE;             //**< @deprecated @see APR_FPROT_UWRITE     */
+  APR_UEXECUTE          = APR_FPROT_UEXECUTE;           //**< @deprecated @see APR_FPROT_UEXECUTE   */
+  APR_GSETID            = APR_FPROT_GSETID;             //**< @deprecated @see APR_FPROT_GSETID     */
+  APR_GREAD             = APR_FPROT_GREAD;              //**< @deprecated @see APR_FPROT_GREAD      */
+  APR_GWRITE            = APR_FPROT_GWRITE;             //**< @deprecated @see APR_FPROT_GWRITE     */
+  APR_GEXECUTE          = APR_FPROT_GEXECUTE;           //**< @deprecated @see APR_FPROT_GEXECUTE   */
+  APR_WSTICKY           = APR_FPROT_WSTICKY;            //**< @deprecated @see APR_FPROT_WSTICKY    */
+  APR_WREAD             = APR_FPROT_WREAD;              //**< @deprecated @see APR_FPROT_WREAD      */
+  APR_WWRITE            = APR_FPROT_WWRITE;             //**< @deprecated @see APR_FPROT_WWRITE     */
+  APR_WEXECUTE          = APR_FPROT_WEXECUTE;           //**< @deprecated @see APR_FPROT_WEXECUTE   */
+  APR_OS_DEFAULT        = APR_FPROT_OS_DEFAULT;         //**< @deprecated @see APR_FPROT_OS_DEFAULT */
+  APR_FILE_SOURCE_PERMS =  APR_FPROT_FILE_SOURCE_PERMS; //**< @deprecated @see APR_FPROT_FILE_SOURCE_PERMS */
+    
+(** @} *)
+
+
+{**
+ * Structure for referencing directories.
+ *}
+//typedef struct apr_dir_t          apr_dir_t;
+type
+  apr_dir_t = record end;
+  Papr_dir_t = ^apr_dir_t;
+  PPapr_dir_t = ^Papr_dir_t;
+
+{**
+ * Structure for determining file permissions.
+ *}
+//typedef apr_int32_t               apr_fileperms_t;
+  apr_fileperms_t = apr_int32_t;
+
+//#if (defined WIN32) || (defined NETWARE)
+{$if defined(WINDOWS) or defined(NETWARE)}
+{**
+ * Structure for determining the device the file is on.
+ *}
+//typedef apr_uint32_t              apr_dev_t;
+  apr_dev_t = apr_uint32_t;
+{$else}
+{**
+ * Structure for determining the device the file is on.
+ *}
+//typedef dev_t                     apr_dev_t;
+  apr_dev_t = dev_t;
+{$endif}
+
+(**
+ * @defgroup apr_file_stat Stat Functions
+ * @{
+ *)
+//** file info structure */
+//typedef struct apr_finfo_t        apr_finfo_t;
+{moved below}
+
+const
+  APR_FINFO_LINK    = $00000001; //**< Stat the link not the file itself if it is a link */
+  APR_FINFO_MTIME   = $00000010; //**< Modification Time */
+  APR_FINFO_CTIME   = $00000020; //**< Creation or inode-changed time */
+  APR_FINFO_ATIME   = $00000040; //**< Access Time */
+  APR_FINFO_SIZE    = $00000100; //**< Size of the file */
+  APR_FINFO_CSIZE   = $00000200; //**< Storage size consumed by the file */
+  APR_FINFO_DEV     = $00001000; //**< Device */
+  APR_FINFO_INODE   = $00002000; //**< Inode */
+  APR_FINFO_NLINK   = $00004000; //**< Number of links */
+  APR_FINFO_TYPE    = $00008000; //**< Type */
+  APR_FINFO_USER    = $00010000; //**< User */
+  APR_FINFO_GROUP   = $00020000; //**< Group */
+  APR_FINFO_UPROT   = $00100000; //**< User protection bits */
+  APR_FINFO_GPROT   = $00200000; //**< Group protection bits */
+  APR_FINFO_WPROT   = $00400000; //**< World protection bits */
+  APR_FINFO_ICASE   = $01000000; //**< if dev is case insensitive */
+  APR_FINFO_NAME    = $02000000; //**< ->name in proper case */
+
+  APR_FINFO_MIN     = $00008170; //**< type, mtime, ctime, atime, size */
+  APR_FINFO_IDENT   = $00003000; //**< dev and inode */
+  APR_FINFO_OWNER   = $00030000; //**< user and group */
+  APR_FINFO_PROT    = $00700000; //**<  all protections */
+  APR_FINFO_NORM    = $0073b170; //**<  an atomic unix apr_stat() */
+  APR_FINFO_DIRENT  = $02000000; //**<  an atomic unix apr_dir_read() */
+
+{**
+ * The file information structure.  This is analogous to the POSIX
+ * stat structure.
+ *}
+type
+  apr_finfo_t = record
+    { Allocates memory and closes lingering handles in the specified pool }
+    pool: Papr_pool_t;
+    { The bitmask describing valid fields of this apr_finfo_t structure
+     *  including all available 'wanted' fields and potentially more }
+    valid: apr_int32_t;
+    { The access permissions of the file.  Mimics Unix access rights. }
+    protection: apr_fileperms_t;
+    { The type of file.  One of APR_REG, APR_DIR, APR_CHR, APR_BLK, APR_PIPE,
+    * APR_LNK or APR_SOCK.  If the type is undetermined, the value is APR_NOFILE.
+     * If the type cannot be determined, the value is APR_UNKFILE.
+     }
+    filetype: apr_filetype_e;
+    { The user id that owns the file }
+    user: apr_uid_t;
+    { The group id that owns the file }
+    group: apr_gid_t;
+    { The inode of the file. }
+    inode: apr_ino_t;
+    { The id of the device the file is on. }
+    device: apr_dev_t;
+    { The number of hard links to the file. }
+    nlink: apr_int32_t;
+    { The size of the file }
+    size: apr_off_t;
+    { The storage size consumed by the file }
+    csize: apr_off_t;
+    { The time the file was last accessed }
+    atime: apr_time_t;
+    { The time the file was last modified }
+    mtime: apr_time_t;
+    { The time the file was last changed }
+    ctime: apr_time_t;
+    { The pathname of the file (possibly unrooted) }
+    fname: PChar;
+    { The file's name (no path) in filesystem case }
+    name: PChar;
+    { The file's handle, if accessed (can be submitted to apr_duphandle) }
+    filehand: Papr_file_t;
+  end;
+  Papr_finfo_t = ^apr_finfo_t;
+
+{**
+ * get the specified file's stats.  The file is specified by filename, 
+ * instead of using a pre-opened file.
+ * @param finfo Where to store the information about the file, which is
+ * never touched if the call fails.
+ * @param fname The name of the file to stat.
+ * @param wanted The desired apr_finfo_t fields, as a bit flag of APR_FINFO_
+                 values 
+ * @param pool the pool to use to allocate the new file. 
+ *
+ * @note If @c APR_INCOMPLETE is returned all the fields in @a finfo may
+ *       not be filled in, and you need to check the @c finfo->valid bitmask
+ *       to verify that what you're looking for is there.
+ *}
+//APR_DECLARE(apr_status_t) apr_stat(apr_finfo_t *finfo, const char *fname,
+//                                   apr_int32_t wanted, apr_pool_t *pool);
+function apr_stat(finfo: Papr_finfo_t; const fname: PChar;
+                  wanted: apr_int32_t; pool: Papr_pool_t): apr_status_t;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibAPR name LibNamePrefix + 'apr_stat' + LibSuff16;
+
+(** @} *)
+(**
+ * @defgroup apr_dir Directory Manipulation Functions
+ * @{
+ *)
+
+(**
+ * Open the specified directory.
+ * @param new_dir The opened directory descriptor.
+ * @param dirname The full path to the directory (use / on all systems)
+ * @param pool The pool to use.
+ *)
+//APR_DECLARE(apr_status_t) apr_dir_open(apr_dir_t **new_dir,
+//                                       const char *dirname,
+//                                       apr_pool_t *pool);
+function apr_dir_open(new_dir: PPapr_dir_t;
+                      const dirname: PChar;
+                      pool: Papr_pool_t): apr_status_t;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibAPR name LibNamePrefix + 'apr_dir_open' + LibSuff12;
+
+(**
+ * close the specified directory. 
+ * @param thedir the directory descriptor to close.
+ *)
+//APR_DECLARE(apr_status_t) apr_dir_close(apr_dir_t *thedir);
+function apr_dir_close(thedir: Papr_dir_t): apr_status_t;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibAPR name LibNamePrefix + 'apr_dir_close' + LibSuff4;
+
+(**
+ * Read the next entry from the specified directory. 
+ * @param finfo the file info structure and filled in by apr_dir_read
+ * @param wanted The desired apr_finfo_t fields, as a bit flag of APR_FINFO_
+                 values 
+ * @param thedir the directory descriptor returned from apr_dir_open
+ * @remark No ordering is guaranteed for the entries read.
+ *
+ * @note If @c APR_INCOMPLETE is returned all the fields in @a finfo may
+ *       not be filled in, and you need to check the @c finfo->valid bitmask
+ *       to verify that what you're looking for is there. When no more
+ *       entries are available, APR_ENOENT is returned.
+ *)
+//APR_DECLARE(apr_status_t) apr_dir_read(apr_finfo_t *finfo, apr_int32_t wanted,
+//                                       apr_dir_t *thedir);
+function apr_dir_read(finfo: Papr_finfo_t; wanted: apr_int32_t;
+                      thedir: Papr_dir_t): apr_status_t;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibAPR name LibNamePrefix + 'apr_dir_read' + LibSuff12;
+
+(**
+ * Rewind the directory to the first entry.
+ * @param thedir the directory descriptor to rewind.
+ *)
+//APR_DECLARE(apr_status_t) apr_dir_rewind(apr_dir_t *thedir);
+function apr_dir_rewind(thedir: Papr_dir_t): apr_status_t;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibAPR name LibNamePrefix + 'apr_dir_rewind' + LibSuff4;
+
+(** @} *)
+
+(**
+ * @defgroup apr_filepath Filepath Manipulation Functions
+ * @{
+ *)
+
+{** Cause apr_filepath_merge to fail if addpath is above rootpath
+ * @bug in APR 0.9 and 1.x, this flag's behavior is undefined
+ * if the rootpath is NULL or empty.  In APR 2.0 this should be
+ * changed to imply NOTABSOLUTE if the rootpath is NULL or empty.
+ *}
+const
+  APR_FILEPATH_NOTABOVEROOT =  $01;
+
+//** internal: Only meaningful with APR_FILEPATH_NOTABOVEROOT */
+  APR_FILEPATH_SECUREROOTTEST =$02;
+
+{** Cause apr_filepath_merge to fail if addpath is above rootpath,
+ * even given a rootpath /foo/bar and an addpath ../bar/bash
+ *}
+  APR_FILEPATH_SECUREROOT =    $03;
+
+//** Fail apr_filepath_merge if the merged path is relative */
+  APR_FILEPATH_NOTRELATIVE =   $04;
+
+//** Fail apr_filepath_merge if the merged path is absolute */
+  APR_FILEPATH_NOTABSOLUTE =   $08;
+
+{** Return the file system's native path format (e.g. path delimiters
+ * of ':' on MacOS9, '\' on Win32, etc.) *}
+  APR_FILEPATH_NATIVE =        $10;
+
+{** Resolve the true case of existing directories and file elements
+ * of addpath, (resolving any aliases on Win32) and append a proper 
+ * trailing slash if a directory
+ *}
+  APR_FILEPATH_TRUENAME =      $20;
+
+{**
+ * Extract the rootpath from the given filepath
+ * @param rootpath the root file path returned with APR_SUCCESS or APR_EINCOMPLETE
+ * @param filepath the pathname to parse for its root component
+ * @param flags the desired rules to apply, from
+ * <PRE>
+ *      APR_FILEPATH_NATIVE    Use native path seperators (e.g. '\' on Win32)
+ *      APR_FILEPATH_TRUENAME  Tests that the root exists, and makes it proper
+ * </PRE>
+ * @param p the pool to allocate the new path string from
+ * @remark on return, filepath points to the first non-root character in the
+ * given filepath.  In the simplest example, given a filepath of "/foo", 
+ * returns the rootpath of "/" and filepath points at "foo".  This is far 
+ * more complex on other platforms, which will canonicalize the root form
+ * to a consistant format, given the APR_FILEPATH_TRUENAME flag, and also
+ * test for the validity of that root (e.g., that a drive d:/ or network 
+ * share //machine/foovol/). 
+ * The function returns APR_ERELATIVE if filepath isn't rooted (an
+ * error), APR_EINCOMPLETE if the root path is ambigious (but potentially
+ * legitimate, e.g. "/" on Windows is incomplete because it doesn't specify
+ * the drive letter), or APR_EBADPATH if the root is simply invalid.
+ * APR_SUCCESS is returned if filepath is an absolute path.
+ *}
+//APR_DECLARE(apr_status_t) apr_filepath_root(const char **rootpath,
+//                                            const char **filepath,
+//                                            apr_int32_t flags,
+//                                            apr_pool_t *p);
+function apr_filepath_root(const rootpath, filepath: PPChar;
+                           flags: apr_int32_t;
+                           p: Papr_pool_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_filepath_root' + LibSuff16;
+
+{**
+ * Merge additional file path onto the previously processed rootpath
+ * @param newpath the merged paths returned
+ * @param rootpath the root file path (NULL uses the current working path)
+ * @param addpath the path to add to the root path
+ * @param flags the desired APR_FILEPATH_ rules to apply when merging
+ * @param p the pool to allocate the new path string from
+ * @remark if the flag APR_FILEPATH_TRUENAME is given, and the addpath 
+ * contains wildcard characters ('*', '?') on platforms that don't support 
+ * such characters within filenames, the paths will be merged, but the 
+ * result code will be APR_EPATHWILD, and all further segments will not
+ * reflect the true filenames including the wildcard and following segments.
+ *}
+//APR_DECLARE(apr_status_t) apr_filepath_merge(char **newpath,
+//                                             const char *rootpath,
+//                                             const char *addpath,
+//                                             apr_int32_t flags,
+//                                             apr_pool_t *p);
+function apr_filepath_merge(newpath: PPChar;
+                            const rootpath, addpath: PPChar;
+                            flags: apr_int32_t;
+                            p: Papr_pool_t): apr_status_t;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibAPR name LibNamePrefix + 'apr_filepath_merge' + LibSuff20;
+
+{**
+ * Split a search path into separate components
+ * @param pathelts the returned components of the search path
+ * @param liststr the search path (e.g., <tt>getenv("PATH")</tt>)
+ * @param p the pool to allocate the array and path components from
+ * @remark empty path componenta do not become part of @a pathelts.
+ * @remark the path separator in @a liststr is system specific;
+ * e.g., ':' on Unix, ';' on Windows, etc.
+ *}
+//APR_DECLARE(apr_status_t) apr_filepath_list_split(apr_array_header_t **pathelts,
+//                                                  const char *liststr,
+//                                                  apr_pool_t *p);
+function apr_filepath_list_split(pathelts: PPapr_array_header_t;
+                                 const liststr: PChar;
+                                 p: Papr_pool_t): apr_status_t;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibAPR name LibNamePrefix + 'apr_filepath_list_split' + LibSuff12;
+
+{**
+ * Merge a list of search path components into a single search path
+ * @param liststr the returned search path; may be NULL if @a pathelts is empty
+ * @param pathelts the components of the search path
+ * @param p the pool to allocate the search path from
+ * @remark emtpy strings in the source array are ignored.
+ * @remark the path separator in @a liststr is system specific;
+ * e.g., ':' on Unix, ';' on Windows, etc.
+ *}
+//APR_DECLARE(apr_status_t) apr_filepath_list_merge(char **liststr,
+//                                                  apr_array_header_t *pathelts,
+//                                                  apr_pool_t *p);
+function apr_filepath_list_merge(liststr: PPChar;
+                                 pathelts: Papr_array_header_t;
+                                 p: Papr_pool_t): apr_status_t;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibAPR name LibNamePrefix + 'apr_filepath_list_merge' + LibSuff12;
+
+{**
+ * Return the default file path (for relative file names)
+ * @param path the default path string returned
+ * @param flags optional flag APR_FILEPATH_NATIVE to retrieve the
+ *              default file path in os-native format.
+ * @param p the pool to allocate the default path string from
+ *}
+//APR_DECLARE(apr_status_t) apr_filepath_get(char **path, apr_int32_t flags,
+//                                           apr_pool_t *p);
+function apr_filepath_get(path: PPChar; flags: apr_int32_t;
+                          p: Papr_pool_t): apr_status_t;
+   {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+   external LibAPR name LibNamePrefix + 'apr_filepath_get' + LibSuff12;
+
+{**
+ * Set the default file path (for relative file names)
+ * @param path the default path returned
+ * @param p the pool to allocate any working storage
+ *}
+//APR_DECLARE(apr_status_t) apr_filepath_set(const char *path, apr_pool_t *p);
+function apr_filepath_set(const path: PChar; p: Papr_pool_t): apr_status_t;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibAPR name LibNamePrefix + 'apr_filepath_set' + LibSuff8;
+
+const
+//** The FilePath character encoding is unknown */
+  APR_FILEPATH_ENCODING_UNKNOWN = 0;
+
+//** The FilePath character encoding is locale-dependent */
+  APR_FILEPATH_ENCODING_LOCALE  = 1;
+
+//** The FilePath character encoding is UTF-8 */
+  APR_FILEPATH_ENCODING_UTF8    = 2;
+
+{**
+ * Determine the encoding used internally by the FilePath functions
+ * @param style points to a variable which receives the encoding style flag
+ * @param p the pool to allocate any working storage
+ * @remark Use @c apr_os_locale_encoding and/or @c apr_os_default_encoding
+ * to get the name of the path encoding if it's not UTF-8.
+ *}
+//APR_DECLARE(apr_status_t) apr_filepath_encoding(int *style, apr_pool_t *p);
+function apr_filepath_encoding(style: PInteger; p: Papr_pool_t): apr_status_t;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibAPR name LibNamePrefix + 'apr_filepath_encoding' + LibSuff8;
+
+(** @} *)
+
+(** @} *)
+
+//#endif  /* ! APR_FILE_INFO_H */

+ 180 - 0
packages/httpd24/src/apr/apr_mmap.inc

@@ -0,0 +1,180 @@
+{* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *}
+
+//#ifndef APR_MMAP_H
+//#define APR_MMAP_H
+
+{**
+ * @file apr_mmap.h
+ * @brief APR MMAP routines
+ *}
+
+//#include "apr.h"
+//#include "apr_pools.h"
+//#include "apr_errno.h"
+//#include "apr_ring.h"
+//#include "apr_file_io.h"        /* for apr_file_t */
+
+//#ifdef BEOS
+//#include <kernel/OS.h>
+//#endif
+
+{$ifdef BEOS}
+type
+  area_id   = Longint;
+{$endif}
+
+(**
+ * @defgroup apr_mmap MMAP (Memory Map) Routines
+ * @ingroup APR 
+ * @{
+ *)
+
+const
+//** MMap opened for reading */
+  APR_MMAP_READ    = 1;
+//** MMap opened for writing */
+  APR_MMAP_WRITE   = 2;
+
+//** @see apr_mmap_t */
+//typedef struct apr_mmap_t            apr_mmap_t;
+type
+  Papr_mmap_t = ^apr_mmap_t;
+
+  link_t = record
+    next,
+    prev: Papr_mmap_t;
+  end;
+
+{**
+ * @remark
+ * As far as I can tell the only really sane way to store an MMAP is as a
+ * void * and a length.  BeOS requires this area_id, but that's just a little
+ * something extra.  I am exposing this type, because it doesn't make much
+ * sense to keep it private, and opening it up makes some stuff easier in
+ * Apache.
+ *}
+///** The MMAP structure */
+  apr_mmap_t = record
+    //** The pool the mmap structure was allocated out of. */
+    cntxt: Papr_pool_t;
+{$ifdef BEOS}
+    //** An area ID.  Only valid on BeOS */
+    area: area_id;
+{$endif}
+{$ifdef WIN32}
+    //** The handle of the file mapping */
+    mhandle: HANDLE;
+    //** The start of the real memory page area (mapped view) */
+    mv: Pointer;
+    //** The physical start, size and offset */
+    pstart: apr_off_t;
+    psize: apr_size_t;
+    poffset: apr_off_t;
+{$endif}
+    //** The start of the memory mapped area */
+    mm: Pointer;
+    //** The amount of data in the mmap */
+    size: apr_size_t;
+    {** ring of apr_mmap_t's that reference the same
+     * mmap'ed region; acts in place of a reference count *}
+//    APR_RING_ENTRY(apr_mmap_t) link;
+(*macro expanded:
+    struct { struct apr_mmap_t * volatile next; struct apr_mmap_t * volatile prev; } link;
+*)
+    link: link_t;
+  end;{apr_mmap_t}
+(* fpc -> rest is ignored
+#if APR_HAS_MMAP || defined(DOXYGEN)
+
+/** @def APR_MMAP_THRESHOLD 
+ * Files have to be at least this big before they're mmap()d.  This is to deal
+ * with systems where the expense of doing an mmap() and an munmap() outweighs
+ * the benefit for small files.  It shouldn't be set lower than 1.
+ */
+#ifdef MMAP_THRESHOLD
+#  define APR_MMAP_THRESHOLD              MMAP_THRESHOLD
+#else
+#  ifdef SUNOS4
+#    define APR_MMAP_THRESHOLD            (8*1024)
+#  else
+#    define APR_MMAP_THRESHOLD            1
+#  endif /* SUNOS4 */
+#endif /* MMAP_THRESHOLD */
+
+/** @def APR_MMAP_LIMIT
+ * Maximum size of MMap region
+ */
+#ifdef MMAP_LIMIT
+#  define APR_MMAP_LIMIT                  MMAP_LIMIT
+#else
+#  define APR_MMAP_LIMIT                  (4*1024*1024)
+#endif /* MMAP_LIMIT */
+
+/** Can this file be MMaped */
+#define APR_MMAP_CANDIDATE(filelength) \
+    ((filelength >= APR_MMAP_THRESHOLD) && (filelength < APR_MMAP_LIMIT))
+
+/*   Function definitions */
+
+/** 
+ * Create a new mmap'ed file out of an existing APR file.
+ * @param newmmap The newly created mmap'ed file.
+ * @param file The file turn into an mmap.
+ * @param offset The offset into the file to start the data pointer at.
+ * @param size The size of the file
+ * @param flag bit-wise or of:
+ * <PRE>
+ *          APR_MMAP_READ       MMap opened for reading
+ *          APR_MMAP_WRITE      MMap opened for writing
+ * </PRE>
+ * @param cntxt The pool to use when creating the mmap.
+ */
+APR_DECLARE(apr_status_t) apr_mmap_create(apr_mmap_t **newmmap, 
+                                          apr_file_t *file, apr_off_t offset,
+                                          apr_size_t size, apr_int32_t flag,
+                                          apr_pool_t *cntxt);
+
+/**
+ * Duplicate the specified MMAP.
+ * @param new_mmap The structure to duplicate into. 
+ * @param old_mmap The mmap to duplicate.
+ * @param p The pool to use for new_mmap.
+ */         
+APR_DECLARE(apr_status_t) apr_mmap_dup(apr_mmap_t **new_mmap,
+                                       apr_mmap_t *old_mmap,
+                                       apr_pool_t *p);
+
+/**
+ * Remove a mmap'ed.
+ * @param mm The mmap'ed file.
+ */
+APR_DECLARE(apr_status_t) apr_mmap_delete(apr_mmap_t *mm);
+
+/** 
+ * Move the pointer into the mmap'ed file to the specified offset.
+ * @param addr The pointer to the offset specified.
+ * @param mm The mmap'ed file.
+ * @param offset The offset to move to.
+ */
+APR_DECLARE(apr_status_t) apr_mmap_offset(void **addr, apr_mmap_t *mm, 
+                                          apr_off_t offset);
+
+#endif /* APR_HAS_MMAP */
+*)
+//** @} */
+
+//#endif  /* ! APR_MMAP_H */

+ 922 - 0
packages/httpd24/src/apr/apr_pools.inc

@@ -0,0 +1,922 @@
+{* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *}
+
+{$ifndef APR_POOLS_H}
+  {$define APR_POOLS_H}
+
+{**
+ * @file apr_pools.h
+ * @brief APR memory allocation
+ *
+ * Resource allocation routines...
+ *
+ * designed so that we don't have to keep track of EVERYTHING so that
+ * it can be explicitly freed later (a fundamentally unsound strategy ---
+ * particularly in the presence of die()).
+ *
+ * Instead, we maintain pools, and allocate items (both memory and I/O
+ * handlers) from the pools --- currently there are two, one for
+ * per-transaction info, and one for config info.  When a transaction is
+ * over, we can delete everything in the per-transaction apr_pool_t without
+ * fear, and without thinking too hard about it either.
+ *
+ * Note that most operations on pools are not thread-safe: a single pool
+ * should only be accessed by a single thread at any given time. The one
+ * exception to this rule is creating a subpool of a given pool: one or more
+ * threads can safely create subpools at the same time that another thread
+ * accesses the parent pool.
+ *}
+
+//#include "apr.h"
+//#include "apr_errno.h"
+//#include "apr_general.h" /* for APR_STRINGIFY */
+//#define APR_WANT_MEMFUNC /**< for no good reason? */
+//#include "apr_want.h"
+
+(**
+ * @defgroup apr_pools Memory Pool Functions
+ * @ingroup APR 
+ * @{
+ *)
+
+//** The fundamental pool type */
+//typedef struct apr_pool_t apr_pool_t;
+{fpc -> apr_pool_t is found in apr-X.X.X/memory/unix/apr_pools.c , not in header files}
+type
+  apr_pool_t = record end;
+  Papr_pool_t = ^apr_pool_t;
+  PPapr_pool_t = ^Papr_pool_t;
+
+{**
+ * Declaration helper macro to construct apr_foo_pool_get()s.
+ *
+ * This standardized macro is used by opaque (APR) data types to return
+ * the apr_pool_t that is associated with the data type.
+ *
+ * APR_POOL_DECLARE_ACCESSOR() is used in a header file to declare the
+ * accessor function. A typical usage and result would be:
+ * <pre>
+ *    APR_POOL_DECLARE_ACCESSOR(file);
+ * becomes:
+ *    APR_DECLARE(apr_pool_t *) apr_file_pool_get(apr_file_t *ob);
+ * </pre>
+ * @remark Doxygen unwraps this macro (via doxygen.conf) to provide 
+ * actual help for each specific occurance of apr_foo_pool_get.
+ * @remark the linkage is specified for APR. It would be possible to expand
+ *       the macros to support other linkages.
+ *}
+//#define APR_POOL_DECLARE_ACCESSOR(type) \
+//    APR_DECLARE(apr_pool_t *) apr_##type##_pool_get \
+//        (const apr_##type##_t *the##type)
+
+{**
+ * Implementation helper macro to provide apr_foo_pool_get()s.
+ *
+ * In the implementation, the APR_POOL_IMPLEMENT_ACCESSOR() is used to
+ * actually define the function. It assumes the field is named "pool".
+ *}
+//#define APR_POOL_IMPLEMENT_ACCESSOR(type) \
+//    APR_DECLARE(apr_pool_t *) apr_##type##_pool_get \
+//            (const apr_##type##_t *the##type) \
+//        { return the##type->pool; }
+
+
+{**
+ * Pool debug levels
+ *
+ * <pre>
+ * | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
+ * ---------------------------------
+ * |   |   |   |   |   |   |   | x |  General debug code enabled (useful in
+ *                                    combination with --with-efence).
+ *
+ * |   |   |   |   |   |   | x |   |  Verbose output on stderr (report
+ *                                    CREATE, CLEAR, DESTROY).
+ *
+ * |   |   |   | x |   |   |   |   |  Verbose output on stderr (report
+ *                                    PALLOC, PCALLOC).
+ *
+ * |   |   |   |   |   | x |   |   |  Lifetime checking. On each use of a
+ *                                    pool, check its lifetime.  If the pool
+ *                                    is out of scope, abort().
+ *                                    In combination with the verbose flag
+ *                                    above, it will output LIFE in such an
+ *                                    event prior to aborting.
+ *
+ * |   |   |   |   | x |   |   |   |  Pool owner checking.  On each use of a
+ *                                    pool, check if the current thread is the
+ *                                    pools owner.  If not, abort().  In
+ *                                    combination with the verbose flag above,
+ *                                    it will output OWNER in such an event
+ *                                    prior to aborting.  Use the debug
+ *                                    function apr_pool_owner_set() to switch
+ *                                    a pools ownership.
+ *
+ * When no debug level was specified, assume general debug mode.
+ * If level 0 was specified, debugging is switched off
+ * </pre>
+ *}
+{#if defined(APR_POOL_DEBUG)
+/* If APR_POOL_DEBUG is blank, we get 1; if it is a number, we get -1. */
+#if (APR_POOL_DEBUG - APR_POOL_DEBUG -1 == 1)
+#undef APR_POOL_DEBUG
+#define APR_POOL_DEBUG 1
+#endif
+#else}
+const
+   APR_POOL_DEBUG = 0;
+//#endif
+
+//** the place in the code where the particular function was called */
+//#define APR_POOL__FILE_LINE__ __FILE__ ":" APR_STRINGIFY(__LINE__)
+
+
+//** A function that is called when allocation fails. */
+//typedef int (*apr_abortfunc_t)(int retcode);
+type
+  apr_abortfunc_t = function (retcode: Integer): Integer;
+
+{*
+ * APR memory structure manipulators (pools, tables, and arrays).
+ *}
+
+{*
+ * Initialization
+ *}
+
+{**
+ * Setup all of the internal structures required to use pools
+ * @remark Programs do NOT need to call this directly.  APR will call this
+ *      automatically from apr_initialize.
+ * @internal
+ *}
+//APR_DECLARE(apr_status_t) apr_pool_initialize(void);
+function apr_pool_initialize: apr_status_t;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibAPR name LibNamePrefix + 'apr_pool_initialize' + LibSuff0;
+
+{**
+ * Tear down all of the internal structures required to use pools
+ * @remark Programs do NOT need to call this directly.  APR will call this
+ *      automatically from apr_terminate.
+ * @internal
+ *}
+//APR_DECLARE(void) apr_pool_terminate(void);
+procedure apr_pool_terminate;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibAPR name LibNamePrefix + 'apr_pool_terminate' + LibSuff0;
+
+
+{*
+ * Pool creation/destruction
+ *}
+
+{$include apr_allocator.inc}
+
+{**
+ * Create a new pool.
+ * @param newpool The pool we have just created.
+ * @param parent The parent pool.  If this is NULL, the new pool is a root
+ *        pool.  If it is non-NULL, the new pool will inherit all
+ *        of its parent pool's attributes, except the apr_pool_t will
+ *        be a sub-pool.
+ * @param abort_fn A function to use if the pool cannot allocate more memory.
+ * @param allocator The allocator to use with the new pool.  If NULL the
+ *        allocator of the parent pool will be used.
+ * @remark This function is thread-safe, in the sense that multiple threads
+ *         can safely create subpools of the same parent pool concurrently.
+ *         Similarly, a subpool can be created by one thread at the same
+ *         time that another thread accesses the parent pool.
+ *}
+//APR_DECLARE(apr_status_t) apr_pool_create_ex(apr_pool_t **newpool,
+//                                             apr_pool_t *parent,
+//                                             apr_abortfunc_t abort_fn,
+//                                             apr_allocator_t *allocator);
+function apr_pool_create_ex(newpool: PPapr_pool_t;
+                            parent: Papr_pool_t;
+                            abort_fn: apr_abortfunc_t;
+                            allocator: Papr_allocator_t): apr_status_t;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibAPR name LibNamePrefix + 'apr_pool_create_ex' + LibSuff16;
+
+{**
+ * Create a new pool.
+ * @deprecated @see apr_pool_create_unmanaged_ex.
+ *}
+//APR_DECLARE(apr_status_t) apr_pool_create_core_ex(apr_pool_t **newpool,
+//                                                  apr_abortfunc_t abort_fn,
+//                                                  apr_allocator_t *allocator);
+function apr_pool_create_core_ex(newpool: PPapr_pool_t;
+                                 abort_fn: apr_abortfunc_t;
+                                 allocator: Papr_allocator_t): apr_status_t;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibAPR name LibNamePrefix + 'apr_pool_create_core_ex' + LibSuff12;
+
+{**
+ * Create a new unmanaged pool.
+ * @param newpool The pool we have just created.
+ * @param abort_fn A function to use if the pool cannot allocate more memory.
+ * @param allocator The allocator to use with the new pool.  If NULL a
+ *        new allocator will be crated with newpool as owner.
+ * @remark An unmanaged pool is a special pool without a parent; it will
+ *         NOT be destroyed upon apr_terminate.  It must be explicitly
+ *         destroyed by calling apr_pool_destroy, to prevent memory leaks.
+ *         Use of this function is discouraged, think twice about whether
+ *         you really really need it.
+ *}
+//APR_DECLARE(apr_status_t) apr_pool_create_unmanaged_ex(apr_pool_t **newpool,
+//                                                   apr_abortfunc_t abort_fn,
+//                                                   apr_allocator_t *allocator);
+function apr_pool_create_unmanaged_ex(newpool: PPapr_pool_t;
+                                      abort_fn: apr_abortfunc_t;
+                                      allocator: Papr_allocator_t): apr_status_t;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibAPR name LibNamePrefix + 'apr_pool_create_unmanaged_ex' + LibSuff12;
+
+{**
+ * Debug version of apr_pool_create_ex.
+ * @param newpool @see apr_pool_create.
+ * @param parent @see apr_pool_create.
+ * @param abort_fn @see apr_pool_create.
+ * @param allocator @see apr_pool_create.
+ * @param file_line Where the function is called from.
+ *        This is usually APR_POOL__FILE_LINE__.
+ * @remark Only available when APR_POOL_DEBUG is defined.
+ *         Call this directly if you have you apr_pool_create_ex
+ *         calls in a wrapper function and wish to override
+ *         the file_line argument to reflect the caller of
+ *         your wrapper function.  If you do not have
+ *         apr_pool_create_ex in a wrapper, trust the macro
+ *         and don't call apr_pool_create_ex_debug directly.
+ *}
+//APR_DECLARE(apr_status_t) apr_pool_create_ex_debug(apr_pool_t **newpool,
+//                                                   apr_pool_t *parent,
+//                                                   apr_abortfunc_t abort_fn,
+//                                                   apr_allocator_t *allocator,
+//                                                   const char *file_line);
+function apr_pool_create_ex_debug(newpool: PPapr_pool_t;
+                                  parent: Papr_pool_t;
+                                  abort_fn: apr_abortfunc_t;
+                                  allocator: Papr_allocator_t;
+                                  const file_line: PChar): apr_status_t;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibAPR name LibNamePrefix + 'apr_pool_create_ex_debug' + LibSuff20;
+
+//#if APR_POOL_DEBUG
+//#define apr_pool_create_ex(newpool, parent, abort_fn, allocator)  \
+//    apr_pool_create_ex_debug(newpool, parent, abort_fn, allocator, \
+//                             APR_POOL__FILE_LINE__)
+//#endif
+
+{**
+ * Debug version of apr_pool_create_core_ex.
+ * @deprecated @see apr_pool_create_unmanaged_ex_debug.
+ *}
+//APR_DECLARE(apr_status_t) apr_pool_create_core_ex_debug(apr_pool_t **newpool,
+//                                                   apr_abortfunc_t abort_fn,
+//                                                   apr_allocator_t *allocator,
+//                                                   const char *file_line);
+function apr_pool_create_core_ex_debug(newpool: PPapr_pool_t;
+                                       abort_fn: apr_abortfunc_t;
+                                       allocator: Papr_allocator_t;
+                                       const file_line: PChar): apr_status_t;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibAPR name LibNamePrefix + 'apr_pool_create_core_ex_debug' + LibSuff16;
+
+{**
+ * Debug version of apr_pool_create_unmanaged_ex.
+ * @param newpool @see apr_pool_create_unmanaged.
+ * @param abort_fn @see apr_pool_create_unmanaged.
+ * @param allocator @see apr_pool_create_unmanaged.
+ * @param file_line Where the function is called from.
+ *        This is usually APR_POOL__FILE_LINE__.
+ * @remark Only available when APR_POOL_DEBUG is defined.
+ *         Call this directly if you have you apr_pool_create_unmanaged_ex
+ *         calls in a wrapper function and wish to override
+ *         the file_line argument to reflect the caller of
+ *         your wrapper function.  If you do not have
+ *         apr_pool_create_core_ex in a wrapper, trust the macro
+ *         and don't call apr_pool_create_core_ex_debug directly.
+ *}
+//APR_DECLARE(apr_status_t) apr_pool_create_unmanaged_ex_debug(apr_pool_t **newpool,
+//                                                   apr_abortfunc_t abort_fn,
+//                                                   apr_allocator_t *allocator,
+//                                                   const char *file_line);
+function apr_pool_create_unmanaged_ex_debug(newpool: PPapr_pool_t;
+                                            abort_fn: apr_abortfunc_t;
+                                            allocator: Papr_allocator_t;
+                                            const file_line: PChar): apr_status_t;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibAPR name LibNamePrefix + 'apr_pool_create_unmanaged_ex_debug' + LibSuff16;
+
+//#if APR_POOL_DEBUG
+//#define apr_pool_create_core_ex(newpool, abort_fn, allocator)  \
+//    apr_pool_create_unmanaged_ex_debug(newpool, abort_fn, allocator, \
+//                                  APR_POOL__FILE_LINE__)
+//
+//#define apr_pool_create_unmanaged_ex(newpool, abort_fn, allocator)  \
+//    apr_pool_create_unmanaged_ex_debug(newpool, abort_fn, allocator, \
+//                                  APR_POOL__FILE_LINE__)
+//
+//#endif
+
+{**
+ * Create a new pool.
+ * @param newpool The pool we have just created.
+ * @param parent The parent pool.  If this is NULL, the new pool is a root
+ *        pool.  If it is non-NULL, the new pool will inherit all
+ *        of its parent pool's attributes, except the apr_pool_t will
+ *        be a sub-pool.
+ * @remark This function is thread-safe, in the sense that multiple threads
+ *         can safely create subpools of the same parent pool concurrently.
+ *         Similarly, a subpool can be created by one thread at the same
+ *         time that another thread accesses the parent pool.
+ *}
+//#if defined(DOXYGEN)
+//APR_DECLARE(apr_status_t) apr_pool_create(apr_pool_t **newpool,
+//                                          apr_pool_t *parent);
+//#else
+//#if APR_POOL_DEBUG
+//#define apr_pool_create(newpool, parent) \
+//    apr_pool_create_ex_debug(newpool, parent, NULL, NULL, \
+//                             APR_POOL__FILE_LINE__)
+//#else
+//#define apr_pool_create(newpool, parent) \
+//    apr_pool_create_ex(newpool, parent, NULL, NULL)
+//#endif
+//#endif
+
+{**
+ * Create a new pool.
+ * @param newpool The pool we have just created.
+ *}
+//#if defined(DOXYGEN)
+//APR_DECLARE(apr_status_t) apr_pool_create_core(apr_pool_t **newpool);
+//APR_DECLARE(apr_status_t) apr_pool_create_unmanaged(apr_pool_t **newpool);
+//#else
+//#if APR_POOL_DEBUG
+//#define apr_pool_create_core(newpool) \
+//    apr_pool_create_unmanaged_ex_debug(newpool, NULL, NULL, \
+//                                  APR_POOL__FILE_LINE__)
+//#define apr_pool_create_unmanaged(newpool) \
+//    apr_pool_create_unmanaged_ex_debug(newpool, NULL, NULL, \
+//                                  APR_POOL__FILE_LINE__)
+//#else
+//#define apr_pool_create_core(newpool) \
+//    apr_pool_create_unmanaged_ex(newpool, NULL, NULL)
+//#define apr_pool_create_unmanaged(newpool) \
+//    apr_pool_create_unmanaged_ex(newpool, NULL, NULL)
+//#endif
+//#endif
+
+{**
+ * Find the pool's allocator
+ * @param pool The pool to get the allocator from.
+ *}
+//APR_DECLARE(apr_allocator_t *) apr_pool_allocator_get(apr_pool_t *pool);
+function apr_pool_allocator_get(pool: Papr_pool_t): Papr_allocator_t;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibAPR name LibNamePrefix + 'apr_pool_allocator_get' + LibSuff4;
+
+{**
+ * Clear all memory in the pool and run all the cleanups. This also destroys all
+ * subpools.
+ * @param p The pool to clear
+ * @remark This does not actually free the memory, it just allows the pool
+ *         to re-use this memory for the next allocation.
+ * @see apr_pool_destroy()
+ *}
+//APR_DECLARE(void) apr_pool_clear(apr_pool_t *p);
+procedure apr_pool_clear(p: Papr_pool_t);
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibAPR name LibNamePrefix + 'apr_pool_clear' + LibSuff4;
+
+{**
+ * Debug version of apr_pool_clear.
+ * @param p See: apr_pool_clear.
+ * @param file_line Where the function is called from.
+ *        This is usually APR_POOL__FILE_LINE__.
+ * @remark Only available when APR_POOL_DEBUG is defined.
+ *         Call this directly if you have you apr_pool_clear
+ *         calls in a wrapper function and wish to override
+ *         the file_line argument to reflect the caller of
+ *         your wrapper function.  If you do not have
+ *         apr_pool_clear in a wrapper, trust the macro
+ *         and don't call apr_pool_destroy_clear directly.
+ *}
+//APR_DECLARE(void) apr_pool_clear_debug(apr_pool_t *p,
+//                                       const char *file_line);
+procedure apr_pool_clear_debug(p: Papr_pool_t; const file_line: PChar);
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibAPR name LibNamePrefix + 'apr_pool_clear_debug' + LibSuff8;
+
+//#if APR_POOL_DEBUG
+//#define apr_pool_clear(p) \
+//    apr_pool_clear_debug(p, APR_POOL__FILE_LINE__)
+//#endif
+
+{**
+ * Destroy the pool. This takes similar action as apr_pool_clear() and then
+ * frees all the memory.
+ * @param p The pool to destroy
+ * @remark This will actually free the memory
+ *}
+//APR_DECLARE(void) apr_pool_destroy(apr_pool_t *p);
+procedure apr_pool_destroy(p: Papr_pool_t);
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibAPR name LibNamePrefix + 'apr_pool_destroy' + LibSuff4;
+
+{**
+ * Debug version of apr_pool_destroy.
+ * @param p See: apr_pool_destroy.
+ * @param file_line Where the function is called from.
+ *        This is usually APR_POOL__FILE_LINE__.
+ * @remark Only available when APR_POOL_DEBUG is defined.
+ *         Call this directly if you have you apr_pool_destroy
+ *         calls in a wrapper function and wish to override
+ *         the file_line argument to reflect the caller of
+ *         your wrapper function.  If you do not have
+ *         apr_pool_destroy in a wrapper, trust the macro
+ *         and don't call apr_pool_destroy_debug directly.
+ *}
+//APR_DECLARE(void) apr_pool_destroy_debug(apr_pool_t *p,
+//                                         const char *file_line);
+procedure apr_pool_destroy_debug(p: Papr_pool_t; const file_line: PChar);
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibAPR name LibNamePrefix + 'apr_pool_destroy_debug' + LibSuff8;
+
+//#if APR_POOL_DEBUG
+//#define apr_pool_destroy(p) \
+//    apr_pool_destroy_debug(p, APR_POOL__FILE_LINE__)
+//#endif
+
+
+{*
+ * Memory allocation
+ *}
+
+{**
+ * Allocate a block of memory from a pool
+ * @param p The pool to allocate from
+ * @param size The amount of memory to allocate
+ * @return The allocated memory
+ *}
+//APR_DECLARE(void *) apr_palloc(apr_pool_t *p, apr_size_t size);
+function apr_palloc(p: Papr_pool_t; size: apr_size_t): Pointer;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibAPR name LibNamePrefix + 'apr_palloc' + LibSuff8;
+
+{**
+ * Debug version of apr_palloc
+ * @param p See: apr_palloc
+ * @param size See: apr_palloc
+ * @param file_line Where the function is called from.
+ *        This is usually APR_POOL__FILE_LINE__.
+ * @return See: apr_palloc
+ *}
+//APR_DECLARE(void *) apr_palloc_debug(apr_pool_t *p, apr_size_t size,
+//                                     const char *file_line);
+function apr_palloc_debug(p: Papr_pool_t; size: apr_size_t;
+                          const file_line: PChar): Pointer;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibAPR name LibNamePrefix + 'apr_palloc_debug' + LibSuff12;
+
+//#if APR_POOL_DEBUG
+//#define apr_palloc(p, size) \
+//    apr_palloc_debug(p, size, APR_POOL__FILE_LINE__)
+//#endif
+
+{**
+ * Allocate a block of memory from a pool and set all of the memory to 0
+ * @param p The pool to allocate from
+ * @param size The amount of memory to allocate
+ * @return The allocated memory
+ *}
+//#if defined(DOXYGEN)
+//APR_DECLARE(void *) apr_pcalloc(apr_pool_t *p, apr_size_t size);
+//#elif !APR_POOL_DEBUG
+//#define apr_pcalloc(p, size) memset(apr_palloc(p, size), 0, size)
+//#endif
+function apr_pcalloc(p: Papr_pool_t; size: apr_size_t): Pointer;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibAPR name LibNamePrefix + 'apr_pcalloc' + LibSuff8;
+
+{**
+ * Debug version of apr_pcalloc
+ * @param p See: apr_pcalloc
+ * @param size See: apr_pcalloc
+ * @param file_line Where the function is called from.
+ *        This is usually APR_POOL__FILE_LINE__.
+ * @return See: apr_pcalloc
+ *}
+//APR_DECLARE(void *) apr_pcalloc_debug(apr_pool_t *p, apr_size_t size,
+//                                      const char *file_line);
+function apr_pcalloc_debug(p: Papr_pool_t; size: apr_size_t;
+                           const file_line: PChar): Pointer;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibAPR name LibNamePrefix + 'apr_pcalloc_debug' + LibSuff12;
+
+//#if APR_POOL_DEBUG
+//#define apr_pcalloc(p, size) \
+//    apr_pcalloc_debug(p, size, APR_POOL__FILE_LINE__)
+//#endif
+
+
+{*
+ * Pool Properties
+ *}
+
+{**
+ * Set the function to be called when an allocation failure occurs.
+ * @remark If the program wants APR to exit on a memory allocation error,
+ *      then this function can be called to set the callback to use (for
+ *      performing cleanup and then exiting). If this function is not called,
+ *      then APR will return an error and expect the calling program to
+ *      deal with the error accordingly.
+ *}
+//APR_DECLARE(void) apr_pool_abort_set(apr_abortfunc_t abortfunc,
+//                                     apr_pool_t *pool);
+procedure apr_pool_abort_set(abortfunc: apr_abortfunc_t; pool: Papr_pool_t);
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibAPR name LibNamePrefix + 'apr_pool_abort_set' + LibSuff8;
+
+{**
+ * Get the abort function associated with the specified pool.
+ * @param pool The pool for retrieving the abort function.
+ * @return The abort function for the given pool.
+ *}
+//APR_DECLARE(apr_abortfunc_t) apr_pool_abort_get(apr_pool_t *pool);
+function apr_pool_abort_get(pool: Papr_pool_t): apr_abortfunc_t;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibAPR name LibNamePrefix + 'apr_pool_abort_get' + LibSuff4;
+
+{**
+ * Get the parent pool of the specified pool.
+ * @param pool The pool for retrieving the parent pool.
+ * @return The parent of the given pool.
+ *}
+//APR_DECLARE(apr_pool_t *) apr_pool_parent_get(apr_pool_t *pool);
+function apr_pool_parent_get(pool: Papr_pool_t): Papr_pool_t;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibAPR name LibNamePrefix + 'apr_pool_parent_get' + LibSuff4;
+
+{**
+ * Determine if pool a is an ancestor of pool b.
+ * @param a The pool to search
+ * @param b The pool to search for
+ * @return True if a is an ancestor of b, NULL is considered an ancestor
+ *         of all pools.
+ * @remark if compiled with APR_POOL_DEBUG, this function will also
+ * return true if A is a pool which has been guaranteed by the caller
+ * (using apr_pool_join) to have a lifetime at least as long as some
+ * ancestor of pool B.
+ *}
+//APR_DECLARE(int) apr_pool_is_ancestor(apr_pool_t *a, apr_pool_t *b);
+function apr_pool_is_ancestor(a, b: Papr_pool_t): Integer;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibAPR name LibNamePrefix + 'apr_pool_is_ancestor' + LibSuff8;
+
+{**
+ * Tag a pool (give it a name)
+ * @param pool The pool to tag
+ * @param tag  The tag
+ *}
+//APR_DECLARE(void) apr_pool_tag(apr_pool_t *pool, const char *tag);
+procedure apr_pool_tag(pool: Papr_pool_t; const tag: PChar);
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibAPR name LibNamePrefix + 'apr_pool_tag' + LibSuff8;
+
+{*
+ * User data management
+ *}
+
+{**
+ * Set the data associated with the current pool
+ * @param data The user data associated with the pool.
+ * @param key The key to use for association
+ * @param cleanup The cleanup program to use to cleanup the data (NULL if none)
+ * @param pool The current pool
+ * @warning The data to be attached to the pool should have a life span
+ *          at least as long as the pool it is being attached to.
+ *
+ *      Users of APR must take EXTREME care when choosing a key to
+ *      use for their data.  It is possible to accidentally overwrite
+ *      data by choosing a key that another part of the program is using.
+ *      Therefore it is advised that steps are taken to ensure that unique
+ *      keys are used for all of the userdata objects in a particular pool
+ *      (the same key in two different pools or a pool and one of its
+ *      subpools is okay) at all times.  Careful namespace prefixing of
+ *      key names is a typical way to help ensure this uniqueness.
+ *
+ *}
+//APR_DECLARE(apr_status_t) apr_pool_userdata_set(
+//    const void *data,
+//    const char *key,
+//    apr_status_t (*cleanup)(void *),
+//    apr_pool_t *pool);
+type
+  cleanup_func_t = function(param: Pointer): apr_status_t; cdecl;
+
+function apr_pool_userdata_set(
+    const data:pointer;
+    const key:Pchar;
+    cleanup: cleanup_func_t;
+    pool:Papr_pool_t): apr_status_t
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibAPR name LibNamePrefix + 'apr_pool_userdata_set' + LibSuff16;
+
+{**
+ * Set the data associated with the current pool
+ * @param data The user data associated with the pool.
+ * @param key The key to use for association
+ * @param cleanup The cleanup program to use to cleanup the data (NULL if none)
+ * @param pool The current pool
+ * @note same as apr_pool_userdata_set(), except that this version doesn't
+ *       make a copy of the key (this function is useful, for example, when
+ *       the key is a string literal)
+ * @warning This should NOT be used if the key could change addresses by
+ *       any means between the apr_pool_userdata_setn() call and a
+ *       subsequent apr_pool_userdata_get() on that key, such as if a
+ *       static string is used as a userdata key in a DSO and the DSO could
+ *       be unloaded and reloaded between the _setn() and the _get().  You
+ *       MUST use apr_pool_userdata_set() in such cases.
+ * @warning More generally, the key and the data to be attached to the
+ *       pool should have a life span at least as long as the pool itself.
+ *
+ *}
+//APR_DECLARE(apr_status_t) apr_pool_userdata_setn(
+//    const void *data,
+//    const char *key,
+//    apr_status_t (*cleanup)(void *),
+//    apr_pool_t *pool);
+function apr_pool_userdata_setn(
+      const data:pointer;
+      const key:Pchar;
+      cleanup: cleanup_func_t;
+      pool:Papr_pool_t): apr_status_t
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibAPR name LibNamePrefix + 'apr_pool_userdata_setn' + LibSuff16;
+
+{**
+ * Return the data associated with the current pool.
+ * @param data The user data associated with the pool.
+ * @param key The key for the data to retrieve
+ * @param pool The current pool.
+ *}
+//APR_DECLARE(apr_status_t) apr_pool_userdata_get(void **data, const char *key,
+//                                                apr_pool_t *pool);
+function apr_pool_userdata_get(data: PPointer; const key: PChar;
+                               pool: Papr_pool_t): apr_status_t;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibAPR name LibNamePrefix + 'apr_pool_userdata_get' + LibSuff12;
+
+
+(**
+ * @defgroup PoolCleanup  Pool Cleanup Functions
+ *
+ * Cleanups are performed in the reverse order they were registered.  That is:
+ * Last In, First Out.  A cleanup function can safely allocate memory from
+ * the pool that is being cleaned up. It can also safely register additional
+ * cleanups which will be run LIFO, directly after the current cleanup
+ * terminates.  Cleanups have to take caution in calling functions that
+ * create subpools. Subpools, created during cleanup will NOT automatically
+ * be cleaned up.  In other words, cleanups are to clean up after themselves.
+ *
+ * @{
+ *)
+
+{**
+ * Register a function to be called when a pool is cleared or destroyed
+ * @param p The pool register the cleanup with
+ * @param data The data to pass to the cleanup function.
+ * @param plain_cleanup The function to call when the pool is cleared
+ *                      or destroyed
+ * @param child_cleanup The function to call when a child process is about
+ *                      to exec - this function is called in the child, obviously!
+ *}
+//APR_DECLARE(void) apr_pool_cleanup_register(
+//    apr_pool_t *p,
+//    const void *data,
+//    apr_status_t (*plain_cleanup)(void *),
+//    apr_status_t (*child_cleanup)(void *));
+procedure apr_pool_cleanup_register(p: Papr_pool_t;
+                                    const data: Pointer;
+                                    plain_cleanup, child_cleanup: cleanup_func_t);
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibAPR name LibNamePrefix + 'apr_pool_cleanup_register' + LibSuff16;
+
+{**
+ * Register a function to be called when a pool is cleared or destroyed.
+ *
+ * Unlike apr_pool_cleanup_register which register a cleanup
+ * that is called AFTER all subpools are destroyed this function register
+ * a function that will be called before any of the subpool is destoryed.
+ *
+ * @param p The pool register the cleanup with
+ * @param data The data to pass to the cleanup function.
+ * @param plain_cleanup The function to call when the pool is cleared
+ *                      or destroyed
+ *}
+//APR_DECLARE(void) apr_pool_pre_cleanup_register(
+//    apr_pool_t *p,
+//    const void *data,
+//    apr_status_t (*plain_cleanup)(void *));
+procedure apr_pool_pre_cleanup_register(p: Papr_pool_t;
+                                        const data: Pointer;
+                                        plain_cleanup: cleanup_func_t);
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibAPR name LibNamePrefix + 'apr_pool_pre_cleanup_register' + LibSuff12;
+
+{**
+ * Remove a previously registered cleanup function.
+ * 
+ * The cleanup most recently registered with @a p having the same values of
+ * @a data and @a cleanup will be removed.
+ *
+ * @param p The pool to remove the cleanup from
+ * @param data The data of the registered cleanup
+ * @param cleanup The function to remove from cleanup
+ * @remarks For some strange reason only the plain_cleanup is handled by this
+ *          function
+ *}
+//APR_DECLARE(void) apr_pool_cleanup_kill(apr_pool_t *p, const void *data,
+//                                        apr_status_t (*cleanup)(void *));
+procedure apr_pool_cleanup_kill(p: Papr_pool_t;
+                                const data: Pointer;
+                                plain_cleanup: cleanup_func_t);
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibAPR name LibNamePrefix + 'apr_pool_cleanup_kill' + LibSuff12;
+
+{**
+ * Replace the child cleanup function of a previously registered cleanup.
+ * 
+ * The cleanup most recently registered with @a p having the same values of
+ * @a data and @a plain_cleanup will have the registered child cleanup
+ * function replaced with @a child_cleanup.
+ *
+ * @param p The pool of the registered cleanup
+ * @param data The data of the registered cleanup
+ * @param plain_cleanup The plain cleanup function of the registered cleanup
+ * @param child_cleanup The function to register as the child cleanup
+ *}
+//APR_DECLARE(void) apr_pool_child_cleanup_set(
+//    apr_pool_t *p,
+//    const void *data,
+//    apr_status_t (*plain_cleanup)(void *),
+//    apr_status_t (*child_cleanup)(void *));
+procedure apr_pool_child_cleanup_set(p: Papr_pool_t;
+                                    const data: Pointer;
+                                    plain_cleanup, child_cleanup: cleanup_func_t);
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibAPR name LibNamePrefix + 'apr_pool_child_cleanup_set' + LibSuff16;
+
+{**
+ * Run the specified cleanup function immediately and unregister it.
+ *
+ * The cleanup most recently registered with @a p having the same values of
+ * @a data and @a cleanup will be removed and @a cleanup will be called
+ * with @a data as the argument.
+ *
+ * @param p The pool to remove the cleanup from
+ * @param data The data to remove from cleanup
+ * @param cleanup The function to remove from cleanup
+ *}
+//APR_DECLARE(apr_status_t) apr_pool_cleanup_run(
+//    apr_pool_t *p,
+//    void *data,
+//    apr_status_t (*cleanup)(void *));
+procedure apr_pool_cleanup_run(p: Papr_pool_t;
+                               data: Pointer;
+                               cleanup: cleanup_func_t);
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibAPR name LibNamePrefix + 'apr_pool_cleanup_run' + LibSuff12;
+
+{**
+ * An empty cleanup function.
+ * 
+ * Passed to apr_pool_cleanup_register() when no cleanup is required.
+ *
+ * @param data The data to cleanup, will not be used by this function.
+ *}
+//APR_DECLARE_NONSTD(apr_status_t) apr_pool_cleanup_null(void *data);
+function apr_pool_cleanup_null(data: Pointer): apr_status_t; cdecl;
+  external LibAPR name 'apr_pool_cleanup_null';
+
+{**
+ * Run all registered child cleanups, in preparation for an exec()
+ * call in a forked child -- close files, etc., but *don't* flush I/O
+ * buffers, *don't* wait for subprocesses, and *don't* free any
+ * memory.
+ *}
+//APR_DECLARE(void) apr_pool_cleanup_for_exec(void);
+procedure apr_pool_cleanup_for_exec;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibAPR name LibNamePrefix + 'apr_pool_cleanup_for_exec' + LibSuff0;
+
+(** @} *)
+
+(**
+ * @defgroup PoolDebug Pool Debugging functions.
+ *
+ * pools have nested lifetimes -- sub_pools are destroyed when the
+ * parent pool is cleared.  We allow certain liberties with operations
+ * on things such as tables (and on other structures in a more general
+ * sense) where we allow the caller to insert values into a table which
+ * were not allocated from the table's pool.  The table's data will
+ * remain valid as long as all the pools from which its values are
+ * allocated remain valid.
+ *
+ * For example, if B is a sub pool of A, and you build a table T in
+ * pool B, then it's safe to insert data allocated in A or B into T
+ * (because B lives at most as long as A does, and T is destroyed when
+ * B is cleared/destroyed).  On the other hand, if S is a table in
+ * pool A, it is safe to insert data allocated in A into S, but it
+ * is *not safe* to insert data allocated from B into S... because
+ * B can be cleared/destroyed before A is (which would leave dangling
+ * pointers in T's data structures).
+ *
+ * In general we say that it is safe to insert data into a table T
+ * if the data is allocated in any ancestor of T's pool.  This is the
+ * basis on which the APR_POOL_DEBUG code works -- it tests these ancestor
+ * relationships for all data inserted into tables.  APR_POOL_DEBUG also
+ * provides tools (apr_pool_find, and apr_pool_is_ancestor) for other
+ * folks to implement similar restrictions for their own data
+ * structures.
+ *
+ * However, sometimes this ancestor requirement is inconvenient --
+ * sometimes it's necessary to create a sub pool where the sub pool is
+ * guaranteed to have the same lifetime as the parent pool.  This is a
+ * guarantee implemented by the *caller*, not by the pool code.  That
+ * is, the caller guarantees they won't destroy the sub pool
+ * individually prior to destroying the parent pool.
+ *
+ * In this case the caller must call apr_pool_join() to indicate this
+ * guarantee to the APR_POOL_DEBUG code.
+ *
+ * These functions are only implemented when #APR_POOL_DEBUG is set.
+ *
+ * @{
+ *)
+//#if APR_POOL_DEBUG || defined(DOXYGEN)
+{$if defined(APR_POOL_DEBUG) or defined(DOXYGEN)}
+{**
+ * Guarantee that a subpool has the same lifetime as the parent.
+ * @param p The parent pool
+ * @param sub The subpool
+ *}
+//APR_DECLARE(void) apr_pool_join(apr_pool_t *p, apr_pool_t *sub);
+
+{**
+ * Find a pool from something allocated in it.
+ * @param mem The thing allocated in the pool
+ * @return The pool it is allocated in
+ *}
+//APR_DECLARE(apr_pool_t *) apr_pool_find(const void *mem);
+
+{**
+ * Report the number of bytes currently in the pool
+ * @param p The pool to inspect
+ * @param recurse Recurse/include the subpools' sizes
+ * @return The number of bytes
+ *}
+//APR_DECLARE(apr_size_t) apr_pool_num_bytes(apr_pool_t *p, int recurse);
+
+{**
+ * Lock a pool
+ * @param pool The pool to lock
+ * @param flag  The flag
+ *}
+//APR_DECLARE(void) apr_pool_lock(apr_pool_t *pool, int flag);
+
+(* @} *)
+
+{$else} //* APR_POOL_DEBUG or DOXYGEN */
+
+//#ifdef apr_pool_join
+//#undef apr_pool_join
+//#endif
+//#define apr_pool_join(a,b)
+//
+//#ifdef apr_pool_lock
+//#undef apr_pool_lock
+//#endif
+//#define apr_pool_lock(pool, lock)
+//
+{$endif} //* APR_POOL_DEBUG or DOXYGEN */
+
+(** @} *)
+
+{$endif} //* !APR_POOLS_H */

+ 432 - 0
packages/httpd24/src/apr/apr_strings.inc

@@ -0,0 +1,432 @@
+{* 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.
+ *}
+
+//* Portions of this file are covered by */
+(* -*- mode: c; c-file-style: "k&r" -*-
+
+  strnatcmp.c -- Perform 'natural order' comparisons of strings in C.
+  Copyright (C) 2000 by Martin Pool <[email protected]>
+
+  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.
+*)
+
+//#ifndef APR_STRINGS_H
+//#define APR_STRINGS_H
+
+{**
+ * @file apr_strings.h
+ * @brief APR Strings library
+ *}
+
+//#include "apr.h"
+//#include "apr_errno.h"
+//#include "apr_pools.h"
+//#define APR_WANT_IOVEC
+//#include "apr_want.h"
+
+//#if APR_HAVE_STDARG_H
+//#include <stdarg.h>
+//#endif
+
+(**
+ * @defgroup apr_strings String routines
+ * @ingroup APR 
+ * @{
+ *)
+
+{**
+ * Do a natural order comparison of two strings.
+ * @param a The first string to compare
+ * @param b The second string to compare
+ * @return Either <0, 0, or >0.  If the first string is less than the second
+ *          this returns <0, if they are equivalent it returns 0, and if the
+ *          first string is greater than second string it retuns >0.
+ *}
+//APR_DECLARE(int) apr_strnatcmp(char const *a, char const *b);
+function apr_strnatcmp(a, b: PChar): Integer;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibAPR name LibNamePrefix + 'apr_strnatcmp' + LibSuff8;
+
+{**
+ * Do a natural order comparison of two strings ignoring the case of the 
+ * strings.
+ * @param a The first string to compare
+ * @param b The second string to compare
+ * @return Either <0, 0, or >0.  If the first string is less than the second
+ *         this returns <0, if they are equivalent it returns 0, and if the
+ *         first string is greater than second string it retuns >0.
+ *}
+//APR_DECLARE(int) apr_strnatcasecmp(char const *a, char const *b);
+function apr_strnatcasecmp(a, b: PChar): Integer;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibAPR name LibNamePrefix + 'apr_strnatcasecmp' + LibSuff8;
+
+{**
+ * duplicate a string into memory allocated out of a pool
+ * @param p The pool to allocate out of
+ * @param s The string to duplicate
+ * @return The new string
+ *}
+//APR_DECLARE(char *) apr_pstrdup(apr_pool_t *p, const char *s);
+function apr_pstrdup(p: Papr_pool_t; s: PChar): PChar;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibAPR name LibNamePrefix + 'apr_pstrdup' + LibSuff8;
+
+{**
+ * Create a null-terminated string by making a copy of a sequence
+ * of characters and appending a null byte
+ * @param p The pool to allocate out of
+ * @param s The block of characters to duplicate
+ * @param n The number of characters to duplicate
+ * @return The new string
+ * @remark This is a faster alternative to apr_pstrndup, for use
+ *         when you know that the string being duplicated really
+ *         has 'n' or more characters.  If the string might contain
+ *         fewer characters, use apr_pstrndup.
+ *}
+//APR_DECLARE(char *) apr_pstrmemdup(apr_pool_t *p, const char *s, apr_size_t n);
+function apr_pstrmemdup(p: Papr_pool_t; s: PChar; n: apr_size_t): PChar;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibAPR name LibNamePrefix + 'apr_pstrmemdup' + LibSuff12;
+
+{**
+ * Duplicate at most n characters of a string into memory allocated 
+ * out of a pool; the new string will be NUL-terminated
+ * @param p The pool to allocate out of
+ * @param s The string to duplicate
+ * @param n The maximum number of characters to duplicate
+ * @return The new string
+ * @remark The amount of memory allocated from the pool is the length
+ *         of the returned string including the NUL terminator
+ *}
+//APR_DECLARE(char *) apr_pstrndup(apr_pool_t *p, const char *s, apr_size_t n);
+function apr_pstrndup(p: Papr_pool_t; s: PChar; n: apr_size_t): PChar;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibAPR name LibNamePrefix + 'apr_pstrndup' + LibSuff12;
+
+{**
+ * Duplicate a block of memory.
+ *
+ * @param p The pool to allocate from
+ * @param m The memory to duplicate
+ * @param n The number of bytes to duplicate
+ * @return The new block of memory
+ *}
+//APR_DECLARE(void *) apr_pmemdup(apr_pool_t *p, const void *m, apr_size_t n);
+function apr_pmemdup(p: Papr_pool_t; m: Pointer; n: apr_size_t): Pointer;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibAPR name LibNamePrefix + 'apr_pmemdup' + LibSuff12;
+
+{**
+ * Concatenate multiple strings, allocating memory out a pool
+ * @param p The pool to allocate out of
+ * @param ... The strings to concatenate.  The final string must be NULL
+ * @return The new string
+ *}
+//APR_DECLARE_NONSTD(char *) apr_pstrcat(apr_pool_t *p, ...)
+//#if defined(__GNUC__) && __GNUC__ >= 4
+//    __attribute__((sentinel))
+//#endif
+//    ;
+function apr_pstrcat(p: Papr_pool_t; params: array of const): PChar; cdecl;
+  external LibAPR name 'apr_pstrcat';
+
+{**
+ * Concatenate multiple strings specified in a writev-style vector
+ * @param p The pool from which to allocate
+ * @param vec The strings to concatenate
+ * @param nvec The number of strings to concatenate
+ * @param nbytes (output) strlen of new string (pass in NULL to omit)
+ * @return The new string
+ *}
+//APR_DECLARE(char *) apr_pstrcatv(apr_pool_t *p, const struct iovec *vec,
+//                                 apr_size_t nvec, apr_size_t *nbytes);
+//function apr_pstrcatv(p: Papr_pool_t; const vec: Piovec;
+//                      nvec: apr_size_t; nbytes: Papr_size_t): PChar;
+//  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+//  external LibAPR name LibNamePrefix + 'apr_pstrcatv' + LibSuff16;
+
+{**
+ * printf-style style printing routine.  The data is output to a string 
+ * allocated from a pool
+ * @param p The pool to allocate out of
+ * @param fmt The format of the string
+ * @param ap The arguments to use while printing the data
+ * @return The new string
+ *}
+//APR_DECLARE(char *) apr_pvsprintf(apr_pool_t *p, const char *fmt, va_list ap);
+function apr_pvsprintf(p: Papr_pool_t; const fmt: PChar; ap: va_list): PChar;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibAPR name LibNamePrefix + 'apr_pvsprintf' + LibSuff12;
+
+{**
+ * printf-style style printing routine.  The data is output to a string 
+ * allocated from a pool
+ * @param p The pool to allocate out of
+ * @param fmt The format of the string
+ * @param ... The arguments to use while printing the data
+ * @return The new string
+ *}
+//APR_DECLARE_NONSTD(char *) apr_psprintf(apr_pool_t *p, const char *fmt, ...)
+//        __attribute__((format(printf,2,3)));
+function apr_psprintf(p: Papr_pool_t; const fmt: PChar; fmt_args: array of const): PChar; cdecl;
+   external LibAPR name 'apr_psprintf';
+
+{**
+ * Copy up to dst_size characters from src to dst; does not copy
+ * past a NUL terminator in src, but always terminates dst with a NUL
+ * regardless.
+ * @param dst The destination string
+ * @param src The source string
+ * @param dst_size The space available in dst; dst always receives
+ *                 NUL termination, so if src is longer than
+ *                 dst_size, the actual number of characters copied is
+ *                 dst_size - 1.
+ * @return Pointer to the NUL terminator of the destination string, dst
+ * @remark
+ * <PRE>
+ * Note the differences between this function and strncpy():
+ *  1) strncpy() doesn't always NUL terminate; apr_cpystrn() does.
+ *  2) strncpy() pads the destination string with NULs, which is often 
+ *     unnecessary; apr_cpystrn() does not.
+ *  3) strncpy() returns a pointer to the beginning of the dst string;
+ *     apr_cpystrn() returns a pointer to the NUL terminator of dst, 
+ *     to allow a check for truncation.
+ * </PRE>
+ *}
+//APR_DECLARE(char *) apr_cpystrn(char *dst, const char *src,
+//                                apr_size_t dst_size);
+function apr_cpystrn(dst: PChar; const src: PChar;
+                     dst_size: apr_size_t): PChar;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibAPR name LibNamePrefix + 'apr_cpystrn' + LibSuff12;
+
+{**
+ * Remove all whitespace from a string
+ * @param dest The destination string.  It is okay to modify the string
+ *             in place.  Namely dest == src
+ * @param src The string to rid the spaces from.
+ * @return A pointer to the destination string's null terminator.
+ *}
+//APR_DECLARE(char *) apr_collapse_spaces(char *dest, const char *src);
+function apr_collapse_spaces(dest: PChar; const src: PChar): PChar;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibAPR name LibNamePrefix + 'apr_collapse_spaces' + LibSuff8;
+
+{**
+ * Convert the arguments to a program from one string to an array of 
+ * strings terminated by a NULL pointer
+ * @param arg_str The arguments to convert
+ * @param argv_out Output location.  This is a pointer to an array of strings.
+ * @param token_context Pool to use.
+ *}
+//APR_DECLARE(apr_status_t) apr_tokenize_to_argv(const char *arg_str,
+//                                               char ***argv_out,
+//                                               apr_pool_t *token_context);
+function apr_tokenize_to_argv(const arg_str: PChar;
+                              var argv_out: PPChar;
+                              token_context: Papr_pool_t): apr_status_t;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibAPR name LibNamePrefix + 'apr_tokenize_to_argv' + LibSuff12;
+
+{**
+ * Split a string into separate null-terminated tokens.  The tokens are 
+ * delimited in the string by one or more characters from the sep
+ * argument.
+ * @param str The string to separate; this should be specified on the
+ *            first call to apr_strtok() for a given string, and NULL
+ *            on subsequent calls.
+ * @param sep The set of delimiters
+ * @param last Internal state saved by apr_strtok() between calls.
+ * @return The next token from the string
+ *}
+//APR_DECLARE(char *) apr_strtok(char *str, const char *sep, char **last);
+function apr_strtok(str: PChar; const sep: PChar; last: PPChar): PChar;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibAPR name LibNamePrefix + 'apr_strtok' + LibSuff12;
+
+(**
+ * @defgroup APR_Strings_Snprintf snprintf implementations
+ * @warning
+ * These are snprintf implementations based on apr_vformatter().
+ *
+ * Note that various standards and implementations disagree on the return
+ * value of snprintf, and side-effects due to %n in the formatting string.
+ * apr_snprintf (and apr_vsnprintf) behaves as follows:
+ *
+ * Process the format string until the entire string is exhausted, or
+ * the buffer fills.  If the buffer fills then stop processing immediately
+ * (so no further %n arguments are processed), and return the buffer
+ * length.  In all cases the buffer is NUL terminated. It will return the
+ * number of characters inserted into the buffer, not including the
+ * terminating NUL. As a special case, if len is 0, apr_snprintf will
+ * return the number of characters that would have been inserted if
+ * the buffer had been infinite (in this case, *buffer can be NULL)
+ *
+ * In no event does apr_snprintf return a negative number.
+ * @{
+ *)
+
+{**
+ * snprintf routine based on apr_vformatter.  This means it understands the
+ * same extensions.
+ * @param buf The buffer to write to
+ * @param len The size of the buffer
+ * @param format The format string
+ * @param ... The arguments to use to fill out the format string.
+ *}
+//APR_DECLARE_NONSTD(int) apr_snprintf(char *buf, apr_size_t len,
+//                                     const char *format, ...)
+//        __attribute__((format(printf,3,4)));
+function apr_snprintf(buf: PChar; len: apr_size_t;
+                      const format: PChar; format_args: array of const): PChar; cdecl;
+  external LibAPR name 'apr_snprintf';
+
+{**
+ * vsnprintf routine based on apr_vformatter.  This means it understands the
+ * same extensions.
+ * @param buf The buffer to write to
+ * @param len The size of the buffer
+ * @param format The format string
+ * @param ap The arguments to use to fill out the format string.
+ *}
+//APR_DECLARE(int) apr_vsnprintf(char *buf, apr_size_t len, const char *format,
+//                               va_list ap);
+function apr_vsnprintf(buf: PChar; len: apr_size_t; const format: PChar;
+                       ap: va_list): Integer;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibAPR name LibNamePrefix + 'apr_vsnprintf' + LibSuff16;
+
+(** @} *)
+
+{**
+ * create a string representation of an int, allocated from a pool
+ * @param p The pool from which to allocate
+ * @param n The number to format
+ * @return The string representation of the number
+ *}
+//APR_DECLARE(char *) apr_itoa(apr_pool_t *p, int n);
+function apr_itoa(p: Papr_pool_t; n: Integer): PChar;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibAPR name LibNamePrefix + 'apr_itoa' + LibSuff8;
+
+{**
+ * create a string representation of a long, allocated from a pool
+ * @param p The pool from which to allocate
+ * @param n The number to format
+ * @return The string representation of the number
+ *}
+//APR_DECLARE(char *) apr_ltoa(apr_pool_t *p, long n);
+function apr_ltoa(p: Papr_pool_t; n: Integer): PChar;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibAPR name LibNamePrefix + 'apr_ltoa' + LibSuff8;
+
+{**
+ * create a string representation of an apr_off_t, allocated from a pool
+ * @param p The pool from which to allocate
+ * @param n The number to format
+ * @return The string representation of the number
+ *}
+//APR_DECLARE(char *) apr_off_t_toa(apr_pool_t *p, apr_off_t n);
+function apr_off_t_toa(p: Papr_pool_t; n: apr_off_t): PChar;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibAPR name LibNamePrefix + 'apr_off_t_toa' + LibSuff12;
+
+{**
+ * Convert a numeric string into an apr_off_t numeric value.
+ * @param offset The value of the parsed string.
+ * @param buf The string to parse. It may contain optional whitespace,
+ *   followed by an optional '+' (positive, default) or '-' (negative)
+ *   character, followed by an optional '0x' prefix if base is 0 or 16,
+ *   followed by numeric digits appropriate for base.
+ * @param end A pointer to the end of the valid character in buf. If
+ *   not NULL, it is set to the first invalid character in buf.
+ * @param base A numeric base in the range between 2 and 36 inclusive,
+ *   or 0.  If base is zero, buf will be treated as base ten unless its
+ *   digits are prefixed with '0x', in which case it will be treated as
+ *   base 16.
+ * @bug *end breaks type safety; where *buf is const, *end needs to be
+ * declared as const in APR 2.0
+ *}
+//APR_DECLARE(apr_status_t) apr_strtoff(apr_off_t *offset, const char *buf,
+//                                      char **end, int base);
+function apr_strtoff(offset: Papr_off_t; const buf: PChar;
+                     end_: PPChar; base: Integer): apr_status_t;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibAPR name LibNamePrefix + 'apr_strtoff' + LibSuff16;
+
+{**
+ * parse a numeric string into a 64-bit numeric value
+ * @param buf The string to parse. It may contain optional whitespace,
+ *   followed by an optional '+' (positive, default) or '-' (negative)
+ *   character, followed by an optional '0x' prefix if base is 0 or 16,
+ *   followed by numeric digits appropriate for base.
+ * @param end A pointer to the end of the valid character in buf. If
+ *   not NULL, it is set to the first invalid character in buf.
+ * @param base A numeric base in the range between 2 and 36 inclusive,
+ *   or 0.  If base is zero, buf will be treated as base ten unless its
+ *   digits are prefixed with '0x', in which case it will be treated as
+ *   base 16.
+ * @return The numeric value of the string.  On overflow, errno is set
+ * to ERANGE.  On success, errno is set to 0.
+ *}
+//APR_DECLARE(apr_int64_t) apr_strtoi64(const char *buf, char **end, int base);
+function apr_strtoi64(const buf: PChar; end_: PPChar; base: Integer): apr_int64_t;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibAPR name LibNamePrefix + 'apr_strtoi64' + LibSuff12;
+
+{**
+ * parse a base-10 numeric string into a 64-bit numeric value.
+ * Equivalent to apr_strtoi64(buf, (char**)NULL, 10).
+ * @param buf The string to parse
+ * @return The numeric value of the string.  On overflow, errno is set
+ * to ERANGE.  On success, errno is set to 0.
+ *}
+//APR_DECLARE(apr_int64_t) apr_atoi64(const char *buf);
+function apr_atoi64(const buf: PChar): apr_int64_t;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibAPR name LibNamePrefix + 'apr_atoi64' + LibSuff4;
+
+{**
+ * Format a binary size (magnitiudes are 2^10 rather than 10^3) from an apr_off_t,
+ * as bytes, K, M, T, etc, to a four character compacted human readable string.
+ * @param size The size to format
+ * @param buf The 5 byte text buffer (counting the trailing null)
+ * @return The buf passed to apr_strfsize()
+ * @remark All negative sizes report '  - ', apr_strfsize only formats positive values.
+ *}
+//APR_DECLARE(char *) apr_strfsize(apr_off_t size, char *buf);
+function apr_strfsize(size: apr_off_t; buf: PChar): PChar;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibAPR name LibNamePrefix + 'apr_strfsize' + LibSuff12;
+
+(** @} *)
+
+//#endif  /* !APR_STRINGS_H */

+ 583 - 0
packages/httpd24/src/apr/apr_tables.inc

@@ -0,0 +1,583 @@
+{* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *}
+
+{$ifndef APR_TABLES_H}
+  {$define APR_TABLES_H}
+
+{**
+ * @file apr_tables.h
+ * @brief APR Table library
+ *}
+
+//#include "apr.h"
+//#include "apr_pools.h"
+
+//#if APR_HAVE_STDARG_H
+//#include <stdarg.h>     /* for va_list */
+//#endif
+
+(**
+ * @defgroup apr_tables Table and Array Functions
+ * @ingroup APR 
+ * Arrays are used to store data which is referenced sequentially or
+ * as a stack.  Functions are provided to push and pop individual
+ * elements as well as to operate on the entire array.
+ *
+ * Tables are used to store data which can be referenced by key.
+ * Limited capabilities are provided for tables with multiple elements
+ * which share a key; while key lookup will return only a single
+ * element, iteration is available.  Additionally, a table can be
+ * compressed to resolve duplicates.
+ *
+ * Both arrays and tables may store string or binary data; some features,
+ * such as concatenation or merging of elements, work only for string
+ * data.
+ * @{
+ *)
+
+//** the table abstract data type */
+//typedef struct apr_table_t apr_table_t;
+type
+  apr_table_t = record end;
+  Papr_table_t = ^apr_table_t;
+
+//** @see apr_array_header_t */
+//typedef struct apr_array_header_t apr_array_header_t;
+  Papr_array_header_t = ^apr_array_header_t;
+  PPapr_array_header_t = ^Papr_array_header_t;
+
+//** An opaque array type */
+  apr_array_header_t = record
+    //** The pool the array is allocated out of */
+    pool: Papr_pool_t;
+    //** The amount of memory allocated for each element of the array */
+    elt_size: Integer;
+    //** The number of active elements in the array */
+    nelts: Integer;
+    //** The number of elements allocated in the array */
+    nalloc: Integer;
+    //** The elements in the array */
+    elts: PChar;
+  end;
+
+{**
+ * The (opaque) structure for string-content tables.
+ *}
+//typedef struct apr_table_entry_t apr_table_entry_t;
+  Papr_table_entry_t = ^apr_table_entry_t;
+
+//** The type for each entry in a string-content table */
+  apr_table_entry_t = record
+    //** The key for the current table entry */
+    key: PChar;          {* maybe NULL in future;
+                         * check when iterating thru table_elts
+                         *}
+    //** The value for the current table entry */
+    val: PChar;
+
+    //** A checksum for the key, for use by the apr_table internals */
+    key_checksum: apr_uint32_t;
+  end;
+
+{**
+ * Get the elements from a table.
+ * @param t The table
+ * @return An array containing the contents of the table
+ *}
+//APR_DECLARE(const apr_array_header_t *) apr_table_elts(const apr_table_t *t);
+function apr_table_elts(const t: Papr_table_t): Papr_array_header_t;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibAPR name LibNamePrefix + 'apr_table_elts' + LibSuff4;
+
+{**
+ * Determine if the table is empty (either NULL or having no elements).
+ * @param t The table to check
+ * @return True if empty, False otherwise
+ *}
+//APR_DECLARE(int) apr_is_empty_table(const apr_table_t *t);
+function apr_is_empty_table(const t: Papr_table_t): Integer;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibAPR name LibNamePrefix + 'apr_is_empty_table' + LibSuff4;
+
+{**
+ * Determine if the array is empty (either NULL or having no elements).
+ * @param a The array to check
+ * @return True if empty, False otherwise
+ *}
+//APR_DECLARE(int) apr_is_empty_array(const apr_array_header_t *a);
+function apr_is_empty_array(const a: Papr_array_header_t): Integer;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibAPR name LibNamePrefix + 'apr_is_empty_array' + LibSuff4;
+
+{**
+ * Create an array.
+ * @param p The pool to allocate the memory out of
+ * @param nelts the number of elements in the initial array
+ * @param elt_size The size of each element in the array.
+ * @return The new array
+ *}
+//APR_DECLARE(apr_array_header_t *) apr_array_make(apr_pool_t *p,
+//                                                 int nelts, int elt_size);
+function apr_array_make(p: Papr_pool_t;
+                        nelts, elt_size: Integer): Papr_array_header_t;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibAPR name LibNamePrefix + 'apr_array_make' + LibSuff12;
+
+{**
+ * Add a new element to an array (as a first-in, last-out stack).
+ * @param arr The array to add an element to.
+ * @return Location for the new element in the array.
+ * @remark If there are no free spots in the array, then this function will
+ *         allocate new space for the new element.
+ *}
+//APR_DECLARE(void *) apr_array_push(apr_array_header_t *arr);
+function apr_array_push(arr: Papr_array_header_t): Pointer;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibAPR name LibNamePrefix + 'apr_array_push' + LibSuff4;
+
+{** A helper macro for accessing a member of an APR array.
+ *
+ * @param ary the array
+ * @param i the index into the array to return
+ * @param type the type of the objects stored in the array
+ *
+ * @return the item at index i
+ *}
+//#define APR_ARRAY_IDX(ary,i,type) (((type *)(ary)->elts)[i])
+
+{** A helper macro for pushing elements into an APR array.
+ *
+ * @param ary the array
+ * @param type the type of the objects stored in the array
+ *
+ * @return the location where the new object should be placed
+ *}
+//#define APR_ARRAY_PUSH(ary,type) (*((type *)apr_array_push(ary)))
+
+{**
+ * Remove an element from an array (as a first-in, last-out stack).
+ * @param arr The array to remove an element from.
+ * @return Location of the element in the array.
+ * @remark If there are no elements in the array, NULL is returned.
+ *}
+//APR_DECLARE(void *) apr_array_pop(apr_array_header_t *arr);
+function apr_array_pop(arr: Papr_array_header_t): Pointer;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibAPR name LibNamePrefix + 'apr_array_pop' + LibSuff4;
+
+{**
+ * Remove all elements from an array.
+ * @param arr The array to remove all elements from.
+ * @remark As the underlying storage is allocated from a pool, no
+ * memory is freed by this operation, but is available for reuse.
+ *}
+//APR_DECLARE(void) apr_array_clear(apr_array_header_t *arr);
+function apr_array_clear(arr: Papr_array_header_t): Pointer;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibAPR name LibNamePrefix + 'apr_array_clear' + LibSuff4;
+
+{**
+ * Concatenate two arrays together.
+ * @param dst The destination array, and the one to go first in the combined 
+ *            array
+ * @param src The source array to add to the destination array
+ *}
+//APR_DECLARE(void) apr_array_cat(apr_array_header_t *dst,
+//			        const apr_array_header_t *src);
+procedure apr_array_cat(dst: Papr_array_header_t;
+                        const src: Papr_array_header_t);
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibAPR name LibNamePrefix + 'apr_array_cat' + LibSuff8;
+
+{**
+ * Copy the entire array.
+ * @param p The pool to allocate the copy of the array out of
+ * @param arr The array to copy
+ * @return An exact copy of the array passed in
+ * @remark The alternate apr_array_copy_hdr copies only the header, and arranges 
+ *         for the elements to be copied if (and only if) the code subsequently
+ *         does a push or arraycat.
+ *}
+//APR_DECLARE(apr_array_header_t *) apr_array_copy(apr_pool_t *p,
+//                                      const apr_array_header_t *arr);
+function apr_array_copy(p: Papr_pool_t;
+                        const arr: Papr_array_header_t): Papr_array_header_t;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibAPR name LibNamePrefix + 'apr_array_copy' + LibSuff8;
+
+{**
+ * Copy the headers of the array, and arrange for the elements to be copied if
+ * and only if the code subsequently does a push or arraycat.
+ * @param p The pool to allocate the copy of the array out of
+ * @param arr The array to copy
+ * @return An exact copy of the array passed in
+ * @remark The alternate apr_array_copy copies the *entire* array.
+ *}
+//APR_DECLARE(apr_array_header_t *) apr_array_copy_hdr(apr_pool_t *p,
+//                                      const apr_array_header_t *arr);
+function apr_array_copy_hdr(p: Papr_pool_t;
+                            const arr: Papr_array_header_t): Papr_array_header_t;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibAPR name LibNamePrefix + 'apr_array_copy_hdr' + LibSuff8;
+
+{**
+ * Append one array to the end of another, creating a new array in the process.
+ * @param p The pool to allocate the new array out of
+ * @param first The array to put first in the new array.
+ * @param second The array to put second in the new array.
+ * @return A new array containing the data from the two arrays passed in.
+*}
+//APR_DECLARE(apr_array_header_t *) apr_array_append(apr_pool_t *p,
+//                                      const apr_array_header_t *first,
+//                                      const apr_array_header_t *second);
+function apr_array_append(p: Papr_pool_t;
+                          const first, second: Papr_array_header_t): Papr_array_header_t;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibAPR name LibNamePrefix + 'apr_array_append' + LibSuff12;
+
+{**
+ * Generate a new string from the apr_pool_t containing the concatenated 
+ * sequence of substrings referenced as elements within the array.  The string 
+ * will be empty if all substrings are empty or null, or if there are no 
+ * elements in the array.  If sep is non-NUL, it will be inserted between 
+ * elements as a separator.
+ * @param p The pool to allocate the string out of
+ * @param arr The array to generate the string from
+ * @param sep The separator to use
+ * @return A string containing all of the data in the array.
+ *}
+//APR_DECLARE(char *) apr_array_pstrcat(apr_pool_t *p,
+//				      const apr_array_header_t *arr,
+//				      const char sep);
+function apr_array_pstrcat(p: Papr_pool_t;
+                           const arr: Papr_array_header_t;
+                           sep: Char): PChar;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibAPR name LibNamePrefix + 'apr_array_pstrcat' + LibSuff12;
+
+{**
+ * Make a new table.
+ * @param p The pool to allocate the pool out of
+ * @param nelts The number of elements in the initial table.
+ * @return The new table.
+ * @warning This table can only store text data
+ *}
+//APR_DECLARE(apr_table_t *) apr_table_make(apr_pool_t *p, int nelts);
+function apr_table_make(p: Papr_pool_t; nelts: Integer): Papr_table_t;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibAPR name LibNamePrefix + 'apr_table_make' + LibSuff8;
+
+{**
+ * Create a new table and copy another table into it.
+ * @param p The pool to allocate the new table out of
+ * @param t The table to copy
+ * @return A copy of the table passed in
+ * @warning The table keys and respective values are not copied
+ *}
+//APR_DECLARE(apr_table_t *) apr_table_copy(apr_pool_t *p,
+//                                          const apr_table_t *t);
+function apr_table_copy(p: Papr_pool_t; const t: Papr_table_t): Papr_table_t;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibAPR name LibNamePrefix + 'apr_table_copy' + LibSuff8;
+
+{**
+ * Create a new table whose contents are deep copied from the given
+ * table. A deep copy operation copies all fields, and makes copies
+ * of dynamically allocated memory pointed to by the fields.
+ * @param p The pool to allocate the new table out of
+ * @param t The table to clone
+ * @return A deep copy of the table passed in
+ *}
+//APR_DECLARE(apr_table_t *) apr_table_clone(apr_pool_t *p,
+//                                           const apr_table_t *t);
+function apr_table_clone(p: Papr_pool_t; const t: Papr_table_t): Papr_table_t;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibAPR name LibNamePrefix + 'apr_table_clone' + LibSuff8;
+
+{**
+ * Delete all of the elements from a table.
+ * @param t The table to clear
+ *}
+//APR_DECLARE(void) apr_table_clear(apr_table_t *t);
+procedure apr_table_clear(t: Papr_table_t);
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibAPR name LibNamePrefix + 'apr_table_clear' + LibSuff4;
+
+{**
+ * Get the value associated with a given key from the table.  After this call,
+ * the data is still in the table.
+ * @param t The table to search for the key
+ * @param key The key to search for (case does not matter)
+ * @return The value associated with the key, or NULL if the key does not exist. 
+ *}
+//APR_DECLARE(const char *) apr_table_get(const apr_table_t *t, const char *key);
+function apr_table_get(t: Papr_table_t; key: PChar): PChar;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibAPR name LibNamePrefix + 'apr_table_get' + LibSuff8;
+
+{**
+ * Add a key/value pair to a table.  If another element already exists with the
+ * same key, this will overwrite the old data.
+ * @param t The table to add the data to.
+ * @param key The key to use (case does not matter)
+ * @param val The value to add
+ * @remark When adding data, this function makes a copy of both the key and the
+ *         value.
+ *}
+//APR_DECLARE(void) apr_table_set(apr_table_t *t, const char *key,
+//                                const char *val);
+procedure apr_table_set(t: Papr_table_t; const key, val: PChar);
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibAPR name LibNamePrefix + 'apr_table_set' + LibSuff12;
+
+{**
+ * Add a key/value pair to a table.  If another element already exists with the
+ * same key, this will overwrite the old data.
+ * @param t The table to add the data to.
+ * @param key The key to use (case does not matter)
+ * @param val The value to add
+ * @warning When adding data, this function does not make a copy of the key or 
+ *          the value, so care should be taken to ensure that the values will 
+ *          not change after they have been added..
+ *}
+//APR_DECLARE(void) apr_table_setn(apr_table_t *t, const char *key,
+//                                 const char *val);
+procedure apr_table_setn(t: Papr_table_t; const key, val: PChar);
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibAPR name LibNamePrefix + 'apr_table_setn' + LibSuff12;
+
+{**
+ * Remove data from the table.
+ * @param t The table to remove data from
+ * @param key The key of the data being removed (case does not matter)
+ *}
+//APR_DECLARE(void) apr_table_unset(apr_table_t *t, const char *key);
+procedure apr_table_unset(t: Papr_table_t; const key: PChar);
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibAPR name LibNamePrefix + 'apr_table_unset' + LibSuff8;
+
+{**
+ * Add data to a table by merging the value with data that has already been 
+ * stored. The merging is done by concatenating the two values, separated
+ * by the string ", ".
+ * @param t The table to search for the data
+ * @param key The key to merge data for (case does not matter)
+ * @param val The data to add
+ * @remark If the key is not found, then this function acts like apr_table_add
+ *}
+//APR_DECLARE(void) apr_table_merge(apr_table_t *t, const char *key,
+//                                  const char *val);
+procedure apr_table_merge(t: Papr_table_t; const key, val: PChar);
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibAPR name LibNamePrefix + 'apr_table_merge' + LibSuff12;
+
+{**
+ * Add data to a table by merging the value with data that has already been 
+ * stored. The merging is done by concatenating the two values, separated
+ * by the string ", ".
+ * @param t The table to search for the data
+ * @param key The key to merge data for (case does not matter)
+ * @param val The data to add
+ * @remark If the key is not found, then this function acts like apr_table_addn
+ *}
+//APR_DECLARE(void) apr_table_mergen(apr_table_t *t, const char *key,
+//                                   const char *val);
+procedure apr_table_mergen(t: Papr_table_t; const key, val: PChar);
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibAPR name LibNamePrefix + 'apr_table_mergen' + LibSuff12;
+
+{**
+ * Add data to a table, regardless of whether there is another element with the
+ * same key.
+ * @param t The table to add to
+ * @param key The key to use
+ * @param val The value to add.
+ * @remark When adding data, this function makes a copy of both the key and the
+ *         value.
+ *}
+//APR_DECLARE(void) apr_table_add(apr_table_t *t, const char *key,
+//                                const char *val);
+procedure apr_table_add(t: Papr_table_t; const key, val: PChar);
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibAPR name LibNamePrefix + 'apr_table_add' + LibSuff12;
+
+{**
+ * Add data to a table, regardless of whether there is another element with the
+ * same key.
+ * @param t The table to add to
+ * @param key The key to use
+ * @param val The value to add.
+ * @remark When adding data, this function does not make a copy of the key or the
+ *         value, so care should be taken to ensure that the values will not 
+ *         change after they have been added.
+ *}
+//APR_DECLARE(void) apr_table_addn(apr_table_t *t, const char *key,
+//                                 const char *val);
+procedure apr_table_addn(t: Papr_table_t; const key, val: PChar);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_table_addn' + LibSuff12;
+
+{**
+ * Merge two tables into one new table.
+ * @param p The pool to use for the new table
+ * @param overlay The first table to put in the new table
+ * @param base The table to add at the end of the new table
+ * @return A new table containing all of the data from the two passed in
+ *}
+//APR_DECLARE(apr_table_t *) apr_table_overlay(apr_pool_t *p,
+//                                             const apr_table_t *overlay,
+//                                             const apr_table_t *base);
+function apr_table_overlay(t: Papr_table_t;
+                           const overlay, base: Papr_table_t): Papr_table_t;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibAPR name LibNamePrefix + 'apr_table_overlay' + LibSuff12;
+
+{**
+ * Declaration prototype for the iterator callback function of apr_table_do()
+ * and apr_table_vdo().
+ * @param rec The data passed as the first argument to apr_table_[v]do()
+ * @param key The key from this iteration of the table
+ * @param value The value from this iteration of the table
+ * @remark Iteration continues while this callback function returns non-zero.
+ * To export the callback function for apr_table_[v]do() it must be declared 
+ * in the _NONSTD convention.
+ *}
+//typedef int (apr_table_do_callback_fn_t)(void *rec, const char *key,
+//                                                    const char *value);
+type
+  apr_table_do_callback_fn_t = function (rec: Pointer; const key, value: PChar): Integer;
+  Papr_table_do_callback_fn_t = ^apr_table_do_callback_fn_t;
+
+{**
+ * Iterate over a table running the provided function once for every
+ * element in the table.  The varargs array must be a list of zero or
+ * more (char *) keys followed by a NULL pointer.  If zero keys are
+ * given, the @param comp function will be invoked for every element
+ * in the table.  Otherwise, the function is invoked only for those
+ * elements matching the keys specified.
+ *
+ * If an invocation of the @param comp function returns zero,
+ * iteration will continue using the next specified key, if any.
+ *
+ * @param comp The function to run
+ * @param rec The data to pass as the first argument to the function
+ * @param t The table to iterate over
+ * @param ... A varargs array of zero or more (char *) keys followed by NULL
+ * @return FALSE if one of the comp() iterations returned zero; TRUE if all
+ *            iterations returned non-zero
+ * @see apr_table_do_callback_fn_t
+ *}
+//APR_DECLARE_NONSTD(int) apr_table_do(apr_table_do_callback_fn_t *comp,
+//                                     void *rec, const apr_table_t *t, ...)
+//#if defined(__GNUC__) && __GNUC__ >= 4
+//    __attribute__((sentinel))
+//#endif
+//    ;
+
+{**
+ * Iterate over a table running the provided function once for every
+ * element in the table.  The @param vp varargs parameter must be a
+ * list of zero or more (char *) keys followed by a NULL pointer.  If
+ * zero keys are given, the @param comp function will be invoked for
+ * every element in the table.  Otherwise, the function is invoked
+ * only for those elements matching the keys specified.
+ *
+ * If an invocation of the @param comp function returns zero,
+ * iteration will continue using the next specified key, if any.
+ *
+ * @param comp The function to run
+ * @param rec The data to pass as the first argument to the function
+ * @param t The table to iterate over
+ * @param vp List of zero or more (char *) keys followed by NULL
+ * @return FALSE if one of the comp() iterations returned zero; TRUE if all
+ *            iterations returned non-zero
+ * @see apr_table_do_callback_fn_t
+ *}
+//APR_DECLARE(int) apr_table_vdo(apr_table_do_callback_fn_t *comp,
+//                               void *rec, const apr_table_t *t, va_list vp);
+function apr_table_vdo(comp: Papr_table_do_callback_fn_t;
+                       rec: Pointer; const t: Papr_table_t; vp: va_list): Integer;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibAPR name LibNamePrefix + 'apr_table_vdo' + LibSuff16;
+
+const
+//** flag for overlap to use apr_table_setn */
+APR_OVERLAP_TABLES_SET   = 0;
+//** flag for overlap to use apr_table_mergen */
+APR_OVERLAP_TABLES_MERGE = 1;
+
+{**
+ * For each element in table b, either use setn or mergen to add the data
+ * to table a.  Which method is used is determined by the flags passed in.
+ * @param a The table to add the data to.
+ * @param b The table to iterate over, adding its data to table a
+ * @param flags How to add the table to table a.  One of:
+ *          APR_OVERLAP_TABLES_SET        Use apr_table_setn
+ *          APR_OVERLAP_TABLES_MERGE      Use apr_table_mergen
+ * @remark  When merging duplicates, the two values are concatenated,
+ *          separated by the string ", ".
+ * @remark  This function is highly optimized, and uses less memory and CPU cycles
+ *          than a function that just loops through table b calling other functions.
+ *}
+(**
+ * Conceptually, apr_table_overlap does this:
+ *
+ * <pre>
+ *  apr_array_header_t *barr = apr_table_elts(b);
+ *  apr_table_entry_t *belt = (apr_table_entry_t * )barr->elts;
+ *  int i;
+ *
+ *  for (i = 0; i < barr->nelts; ++i) {
+ *      if (flags & APR_OVERLAP_TABLES_MERGE) {
+ *          apr_table_mergen(a, belt[i].key, belt[i].val);
+ *      }
+ *      else {
+ *          apr_table_setn(a, belt[i].key, belt[i].val);
+ *      }
+ *  }
+ * </pre>
+ *
+ *  Except that it is more efficient (less space and cpu-time) especially
+ *  when b has many elements.
+ *
+ *  Notice the assumptions on the keys and values in b -- they must be
+ *  in an ancestor of a's pool.  In practice b and a are usually from
+ *  the same pool.
+ *)
+//APR_DECLARE(void) apr_table_overlap(apr_table_t *a, const apr_table_t *b,
+//                                     unsigned flags);
+procedure apr_table_overlap(a: Papr_table_t; const b: Papr_table_t; flags: cuint);
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibAPR name LibNamePrefix + 'apr_table_overlap' + LibSuff12;
+
+{**
+ * Eliminate redundant entries in a table by either overwriting
+ * or merging duplicates.
+ *
+ * @param t Table.
+ * @param flags APR_OVERLAP_TABLES_MERGE to merge, or
+ *              APR_OVERLAP_TABLES_SET to overwrite
+ * @remark When merging duplicates, the two values are concatenated,
+ *         separated by the string ", ".
+ *}
+//APR_DECLARE(void) apr_table_compress(apr_table_t *t, unsigned flags);
+procedure apr_table_compress(t: Papr_table_t; flags: cuint);
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibAPR name LibNamePrefix + 'apr_table_compress' + LibSuff8;
+
+(** @} *)
+
+{$endif}	//* ! APR_TABLES_H */

+ 283 - 0
packages/httpd24/src/apr/apr_time.inc

@@ -0,0 +1,283 @@
+{* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *}
+
+//#ifndef APR_TIME_H
+//#define APR_TIME_H
+
+{**
+ * @file apr_time.h
+ * @brief APR Time Library
+ *}
+
+//#include "apr.h"
+//#include "apr_pools.h"
+//#include "apr_errno.h"
+
+(**
+ * @defgroup apr_time Time Routines
+ * @ingroup APR 
+ * @{
+ *)
+
+//** month names */
+//APR_DECLARE_DATA extern const char apr_month_snames[12][4];
+//** day names */
+//APR_DECLARE_DATA extern const char apr_day_snames[7][4];
+
+type
+//** number of microseconds since 00:00:00 january 1, 1970 UTC */
+//typedef apr_int64_t apr_time_t;
+  apr_time_t = apr_int64_t;
+  Papr_time_t = ^apr_time_t;
+
+//** mechanism to properly type apr_time_t literals */
+//#define APR_TIME_C(val) APR_INT64_C(val)
+
+//** mechanism to properly print apr_time_t values */
+//#define APR_TIME_T_FMT APR_INT64_T_FMT
+
+//** intervals for I/O timeouts, in microseconds */
+//typedef apr_int64_t apr_interval_time_t;
+  apr_interval_time_t = apr_int64_t;
+  Papr_interval_time_t = ^apr_interval_time_t;
+
+//** short interval for I/O timeouts, in microseconds */
+//typedef apr_int32_t apr_short_interval_time_t;
+  apr_short_interval_time_t = apr_int32_t;
+{
+/** number of microseconds per second */
+#define APR_USEC_PER_SEC APR_TIME_C(1000000)
+
+/** @return apr_time_t as a second */
+#define apr_time_sec(time) ((time) / APR_USEC_PER_SEC)
+
+/** @return apr_time_t as a usec */
+#define apr_time_usec(time) ((time) % APR_USEC_PER_SEC)
+
+/** @return apr_time_t as a msec */
+#define apr_time_msec(time) (((time) / 1000) % 1000)
+
+/** @return apr_time_t as a msec */
+#define apr_time_as_msec(time) ((time) / 1000)
+
+/** @return milliseconds as an apr_time_t */
+#define apr_time_from_msec(msec) ((apr_time_t)(msec) * 1000)
+
+/** @return seconds as an apr_time_t */
+#define apr_time_from_sec(sec) ((apr_time_t)(sec) * APR_USEC_PER_SEC)
+
+/** @return a second and usec combination as an apr_time_t */
+#define apr_time_make(sec, usec) ((apr_time_t)(sec) * APR_USEC_PER_SEC \
+                                + (apr_time_t)(usec))
+}
+{**
+ * @return the current time
+ *}
+//APR_DECLARE(apr_time_t) apr_time_now(void);
+function apr_time_now: apr_time_t;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibAPR name LibNamePrefix + 'apr_time_now' + LibSuff0;
+
+//** @see apr_time_exp_t */
+//typedef struct apr_time_exp_t apr_time_exp_t;
+  type
+    Papr_time_exp_t = ^apr_time_exp_t;
+
+{**
+ * a structure similar to ANSI struct tm with the following differences:
+ *  - tm_usec isn't an ANSI field
+ *  - tm_gmtoff isn't an ANSI field (it's a bsdism)
+ *}
+ apr_time_exp_t = record
+    //** microseconds past tm_sec */
+    tm_usec: apr_int32_t;
+    //** (0-61) seconds past tm_min */
+    tm_sec: apr_int32_t;
+    //** (0-59) minutes past tm_hour */
+    tm_min: apr_int32_t;
+    //** (0-23) hours past midnight */
+    tm_hour: apr_int32_t;
+    //** (1-31) day of the month */
+    tm_mday: apr_int32_t;
+    //** (0-11) month of the year */
+    tm_mon: apr_int32_t;
+    //** year since 1900 */
+    tm_year: apr_int32_t;
+    //** (0-6) days since sunday */
+    tm_wday: apr_int32_t;
+    //** (0-365) days since jan 1 */
+    tm_yday: apr_int32_t;
+    //** daylight saving time */
+    tm_isdst: apr_int32_t;
+    //** seconds east of UTC */
+    tm_gmtoff: apr_int32_t;
+  end;
+
+{**
+ * convert an ansi time_t to an apr_time_t
+ * @param result the resulting apr_time_t
+ * @param input the time_t to convert
+ *}
+//APR_DECLARE(apr_status_t) apr_time_ansi_put(apr_time_t *result,
+//                                                    time_t input);
+function apr_time_ansi_put(result: Papr_time_t;
+                           input: time_t): apr_status_t;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibAPR name LibNamePrefix + 'apr_time_ansi_put' + LibSuff12;//time_t is 64bit so it is 12
+
+{**
+ * convert a time to its human readable components using an offset
+ * from GMT
+ * @param result the exploded time
+ * @param input the time to explode
+ * @param offs the number of seconds offset to apply
+ *}
+//APR_DECLARE(apr_status_t) apr_time_exp_tz(apr_time_exp_t *result,
+//                                          apr_time_t input,
+//                                          apr_int32_t offs);
+function apr_time_exp_tz(result_: Papr_time_exp_t;
+                         input_: apr_time_t;
+                         offs: apr_int32_t): apr_status_t;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibAPR name LibNamePrefix + 'apr_time_exp_tz' + LibSuff16;//apr_time_t is 64bit so it is 16
+
+{**
+ * convert a time to its human readable components in GMT timezone
+ * @param result the exploded time
+ * @param input the time to explode
+ *}
+//APR_DECLARE(apr_status_t) apr_time_exp_gmt(apr_time_exp_t *result,
+//                                           apr_time_t input);
+function apr_time_exp_gmt(result_: Papr_time_exp_t;
+                          input_: apr_time_t): apr_status_t;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibAPR name LibNamePrefix + 'apr_time_exp_gmt' + LibSuff12;//apr_time_t is 64bit so it is 12
+
+{**
+ * convert a time to its human readable components in local timezone
+ * @param result the exploded time
+ * @param input the time to explode
+ *}
+//APR_DECLARE(apr_status_t) apr_time_exp_lt(apr_time_exp_t *result,
+//                                          apr_time_t input);
+function apr_time_exp_lt(result_: Papr_time_exp_t;
+                         input_: apr_time_t): apr_status_t;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibAPR name LibNamePrefix + 'apr_time_exp_lt' + LibSuff12;//apr_time_t is 64bit so it is 12
+
+{**
+ * Convert time value from human readable format to a numeric apr_time_t 
+ * e.g. elapsed usec since epoch
+ * @param result the resulting imploded time
+ * @param input the input exploded time
+ *}
+//APR_DECLARE(apr_status_t) apr_time_exp_get(apr_time_t *result,
+//                                           apr_time_exp_t *input);
+function apr_time_exp_get(result_: Papr_time_t;
+                          input_: Papr_time_exp_t): apr_status_t;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibAPR name LibNamePrefix + 'apr_time_exp_get' + LibSuff8;
+
+{**
+ * Convert time value from human readable format to a numeric apr_time_t that
+ * always represents GMT
+ * @param result the resulting imploded time
+ * @param input the input exploded time
+ *}
+//APR_DECLARE(apr_status_t) apr_time_exp_gmt_get(apr_time_t *result,
+//                                               apr_time_exp_t *input);
+function apr_time_exp_gmt_get(result_: Papr_time_t;
+                              input_: Papr_time_exp_t): apr_status_t;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibAPR name LibNamePrefix + 'apr_time_exp_gmt_get' + LibSuff8;
+
+{**
+ * Sleep for the specified number of micro-seconds.
+ * @param t desired amount of time to sleep.
+ * @warning May sleep for longer than the specified time. 
+ *}
+//APR_DECLARE(void) apr_sleep(apr_interval_time_t t);
+procedure apr_sleep(t: apr_interval_time_t);
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibAPR name LibNamePrefix + 'apr_sleep' + LibSuff8;//apr_interval_time_t is 64bit, so it is 8
+
+//** length of a RFC822 Date */
+//#define APR_RFC822_DATE_LEN (30)
+const APR_RFC822_DATE_LEN = (30);
+
+{**
+ * apr_rfc822_date formats dates in the RFC822
+ * format in an efficient manner.  It is a fixed length
+ * format which requires the indicated amount of storage,
+ * including the trailing NUL terminator.
+ * @param date_str String to write to.
+ * @param t the time to convert 
+ *}
+//APR_DECLARE(apr_status_t) apr_rfc822_date(char *date_str, apr_time_t t);
+function apr_rfc822_date(date_str: PChar; t: apr_time_t): apr_status_t;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibAPR name LibNamePrefix + 'apr_rfc822_date' + LibSuff12;//apr_time_t is 64bit so it is 12
+
+//** length of a CTIME date */
+//#define APR_CTIME_LEN (25)
+const APR_CTIME_LEN = (25);
+{**
+ * apr_ctime formats dates in the ctime() format
+ * in an efficient manner.  it is a fixed length format
+ * and requires the indicated amount of storage including
+ * the trailing NUL terminator.
+ * Unlike ANSI/ISO C ctime(), apr_ctime() does not include
+ * a \n at the end of the string.
+ * @param date_str String to write to.
+ * @param t the time to convert 
+ *}
+//APR_DECLARE(apr_status_t) apr_ctime(char *date_str, apr_time_t t);
+function apr_ctime(date_str: PChar; t: apr_time_t): apr_status_t;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibAPR name LibNamePrefix + 'apr_ctime' + LibSuff12;//apr_time_t is 64bit so it is 12
+
+{**
+ * formats the exploded time according to the format specified
+ * @param s string to write to
+ * @param retsize The length of the returned string
+ * @param max The maximum length of the string
+ * @param format The format for the time string
+ * @param tm The time to convert
+ *}
+//APR_DECLARE(apr_status_t) apr_strftime(char *s, apr_size_t *retsize,
+//                                       apr_size_t max, const char *format,
+//                                       apr_time_exp_t *tm);
+function apr_strftime(s: PChar;
+                      retsize, max: apr_size_t;
+                      const format_: PChar;
+                      tm: Papr_time_exp_t): apr_status_t;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibAPR name LibNamePrefix + 'apr_strftime' + LibSuff20;
+
+{**
+ * Improve the clock resolution for the lifetime of the given pool.
+ * Generally this is only desireable on benchmarking and other very
+ * time-sensitive applications, and has no impact on most platforms.
+ * @param p The pool to associate the finer clock resolution 
+ *}
+//APR_DECLARE(void) apr_time_clock_hires(apr_pool_t *p);
+procedure apr_time_clock_hires(p: Papr_pool_t);
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibAPR name LibNamePrefix + 'apr_time_clock_hires' + LibSuff4;
+
+(** @} *)
+
+//#endif  /* ! APR_TIME_H */

+ 181 - 0
packages/httpd24/src/apr/apr_user.inc

@@ -0,0 +1,181 @@
+{* 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.
+ *}
+
+//fndef APR_USER_H
+//efine APR_USER_H
+
+{**
+ * @file apr_user.h
+ * @brief APR User ID Services 
+ *}
+
+//#include "apr.h"
+//#include "apr_errno.h"
+//#include "apr_pools.h"
+
+(**
+ * @defgroup apr_user User and Group ID Services
+ * @ingroup APR 
+ * @{
+ *)
+
+{**
+ * Structure for determining user ownership.
+ *}
+type
+{$ifdef WINDOWS}
+  apr_uid_t = PSID;
+{$else}
+  apr_uid_t = uid_t;
+{$endif}
+  Papr_uid_t = ^apr_uid_t;
+
+{**
+ * Structure for determining group ownership.
+ *}
+{$ifdef WINDOWS}
+  apr_gid_t = PSID;
+{$else}
+  apr_gid_t = gid_t;
+{$endif}
+  Papr_gid_t = ^apr_gid_t;
+
+//#if APR_HAS_USER
+
+{**
+ * Get the userid (and groupid) of the calling process
+ * @param userid   Returns the user id
+ * @param groupid  Returns the user's group id
+ * @param p The pool from which to allocate working space
+ * @remark This function is available only if APR_HAS_USER is defined.
+ *}
+//APR_DECLARE(apr_status_t) apr_uid_current(apr_uid_t *userid,
+//                                          apr_gid_t *groupid,
+//                                          apr_pool_t *p);
+function apr_uid_current(userid: Papr_uid_t;
+                         groupid: Papr_gid_t;
+                         p: Papr_pool_t): apr_status_t;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibAPR name LibNamePrefix + 'apr_uid_current' + LibSuff12;
+
+{**
+ * Get the user name for a specified userid
+ * @param username Pointer to new string containing user name (on output)
+ * @param userid The userid
+ * @param p The pool from which to allocate the string
+ * @remark This function is available only if APR_HAS_USER is defined.
+ *}
+//APR_DECLARE(apr_status_t) apr_uid_name_get(char **username, apr_uid_t userid,
+//                                           apr_pool_t *p);
+function apr_uid_name_get(username: PPChar; userid: apr_uid_t;
+                          p: Papr_pool_t): apr_status_t;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibAPR name LibNamePrefix + 'apr_uid_name_get' + LibSuff12;
+
+
+{**
+ * Get the userid (and groupid) for the specified username
+ * @param userid   Returns the user id
+ * @param groupid  Returns the user's group id
+ * @param username The username to lookup
+ * @param p The pool from which to allocate working space
+ * @remark This function is available only if APR_HAS_USER is defined.
+ *}
+//APR_DECLARE(apr_status_t) apr_uid_get(apr_uid_t *userid, apr_gid_t *groupid,
+//                                      const char *username, apr_pool_t *p);
+function apr_uid_get(userid: Papr_uid_t; groupid: Papr_gid_t;
+                     const username: PChar; p: Papr_pool_t): apr_status_t;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibAPR name LibNamePrefix + 'apr_uid_get' + LibSuff16;
+
+{**
+ * Get the home directory for the named user
+ * @param dirname Pointer to new string containing directory name (on output)
+ * @param username The named user
+ * @param p The pool from which to allocate the string
+ * @remark This function is available only if APR_HAS_USER is defined.
+ *}
+//APR_DECLARE(apr_status_t) apr_uid_homepath_get(char **dirname,
+//                                               const char *username,
+//                                               apr_pool_t *p);
+function apr_uid_homepath_get(dirname: PPChar;
+                              const username: PChar;
+                              p: Papr_pool_t): apr_status_t;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibAPR name LibNamePrefix + 'apr_uid_homepath_get' + LibSuff12;
+
+{**
+ * Compare two user identifiers for equality.
+ * @param left One uid to test
+ * @param right Another uid to test
+ * @return APR_SUCCESS if the apr_uid_t strutures identify the same user,
+ * APR_EMISMATCH if not, APR_BADARG if an apr_uid_t is invalid.
+ * @remark This function is available only if APR_HAS_USER is defined.
+ *}
+//#if defined(WIN32)
+//APR_DECLARE(apr_status_t) apr_uid_compare(apr_uid_t left, apr_uid_t right);
+//#else
+//#define apr_uid_compare(left,right) (((left) == (right)) ? APR_SUCCESS : APR_EMISMATCH)
+//#endif
+
+{**
+ * Get the group name for a specified groupid
+ * @param groupname Pointer to new string containing group name (on output)
+ * @param groupid The groupid
+ * @param p The pool from which to allocate the string
+ * @remark This function is available only if APR_HAS_USER is defined.
+ *}
+//APR_DECLARE(apr_status_t) apr_gid_name_get(char **groupname,
+//                                             apr_gid_t groupid, apr_pool_t *p);
+function apr_gid_name_get(groupname: PPChar;
+                          groupid: apr_gid_t; p: Papr_pool_t): apr_status_t;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibAPR name LibNamePrefix + 'apr_gid_name_get' + LibSuff12;
+
+
+{**
+ * Get the groupid for a specified group name
+ * @param groupid Pointer to the group id (on output)
+ * @param groupname The group name to look up
+ * @param p The pool from which to allocate the string
+ * @remark This function is available only if APR_HAS_USER is defined.
+ *}
+//APR_DECLARE(apr_status_t) apr_gid_get(apr_gid_t *groupid,
+//                                      const char *groupname, apr_pool_t *p);
+function apr_gid_get(groupid: Papr_gid_t;
+                     const groupname: PChar; p: Papr_pool_t): apr_status_t;
+   {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+   external LibAPR name LibNamePrefix + 'apr_gid_get' + LibSuff12;
+
+{**
+ * Compare two group identifiers for equality.
+ * @param left One gid to test
+ * @param right Another gid to test
+ * @return APR_SUCCESS if the apr_gid_t strutures identify the same group,
+ * APR_EMISMATCH if not, APR_BADARG if an apr_gid_t is invalid.
+ * @remark This function is available only if APR_HAS_USER is defined.
+ *}
+//#if defined(WIN32)
+//APR_DECLARE(apr_status_t) apr_gid_compare(apr_gid_t left, apr_gid_t right);
+//#else
+//#define apr_gid_compare(left,right) (((left) == (right)) ? APR_SUCCESS : APR_EMISMATCH)
+//#endif
+
+//#endif  /* ! APR_HAS_USER */
+
+(** @} *)
+
+//#endif  /* ! APR_USER_H */

+ 162 - 0
packages/httpd24/src/apr/apr_version.inc

@@ -0,0 +1,162 @@
+{* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *}
+
+//#ifndef APR_VERSION_H
+//#define APR_VERSION_H
+
+{**
+ * @file apr_version.h
+ * @brief APR Versioning Interface
+ * 
+ * APR's Version
+ *
+ * There are several different mechanisms for accessing the version. There
+ * is a string form, and a set of numbers; in addition, there are constants
+ * which can be compiled into your application, and you can query the library
+ * being used for its actual version.
+ *
+ * Note that it is possible for an application to detect that it has been
+ * compiled against a different version of APR by use of the compile-time
+ * constants and the use of the run-time query function.
+ *
+ * APR version numbering follows the guidelines specified in:
+ *
+ *     http://apr.apache.org/versioning.html
+ *}
+
+
+{* The numeric compile-time version constants. These constants are the
+ * authoritative version numbers for APR. 
+ *}
+
+const
+{** major version 
+ * Major API changes that could cause compatibility problems for older
+ * programs such as structure size changes.  No binary compatibility is
+ * possible across a change in the major version.
+ *}
+  APR_MAJOR_VERSION       = 1;
+
+{** minor version
+ * Minor API changes that do not cause binary compatibility problems.
+ * Reset to 0 when upgrading APR_MAJOR_VERSION
+ *}
+  APR_MINOR_VERSION       = 4;
+
+{** patch level 
+ * The Patch Level never includes API changes, simply bug fixes.
+ * Reset to 0 when upgrading APR_MINOR_VERSION
+ *}
+  APR_PATCH_VERSION       = 6;
+
+{** 
+ * The symbol APR_IS_DEV_VERSION is only defined for internal,
+ * "development" copies of APR.  It is undefined for released versions
+ * of APR.
+ *}
+//* #define APR_IS_DEV_VERSION */
+
+{**
+ * Check at compile time if the APR version is at least a certain
+ * level.
+ * @param major The major version component of the version checked
+ * for (e.g., the "1" of "1.3.0").
+ * @param minor The minor version component of the version checked
+ * for (e.g., the "3" of "1.3.0").
+ * @param patch The patch level component of the version checked
+ * for (e.g., the "0" of "1.3.0").
+ * @remark This macro is available with APR versions starting with
+ * 1.3.0.
+ *}
+//#define APR_VERSION_AT_LEAST(major,minor,patch)                    \
+//(((major) < APR_MAJOR_VERSION)                                     \
+// || ((major) == APR_MAJOR_VERSION && (minor) < APR_MINOR_VERSION) \
+// || ((major) == APR_MAJOR_VERSION && (minor) == APR_MINOR_VERSION && (patch) <= APR_PATCH_VERSION))
+
+//#if defined(APR_IS_DEV_VERSION) || defined(DOXYGEN)
+///** Internal: string form of the "is dev" flag */
+//#define APR_IS_DEV_STRING "-dev"
+//#else
+//#define APR_IS_DEV_STRING ""
+  APR_IS_DEV_STRING = '';
+//#endif
+{
+/* APR_STRINGIFY is defined here, and also in apr_general.h, so wrap it */
+#ifndef APR_STRINGIFY
+/** Properly quote a value as a string in the C preprocessor */
+#define APR_STRINGIFY(n) APR_STRINGIFY_HELPER(n)
+/** Helper macro for APR_STRINGIFY */
+#define APR_STRINGIFY_HELPER(n) #n
+#endif
+
+/** The formatted string of APR's version */
+#define APR_VERSION_STRING \
+     APR_STRINGIFY(APR_MAJOR_VERSION) "." \
+     APR_STRINGIFY(APR_MINOR_VERSION) "." \
+     APR_STRINGIFY(APR_PATCH_VERSION) \
+     APR_IS_DEV_STRING
+
+/** An alternative formatted string of APR's version */
+/* macro for Win32 .rc files using numeric csv representation */
+#define APR_VERSION_STRING_CSV APR_MAJOR_VERSION ##, \
+                             ##APR_MINOR_VERSION ##, \
+                             ##APR_PATCH_VERSION
+
+
+#ifndef APR_VERSION_ONLY
+
+/* The C language API to access the version at run time, 
+ * as opposed to compile time.  APR_VERSION_ONLY may be defined 
+ * externally when preprocessing apr_version.h to obtain strictly 
+ * the C Preprocessor macro declarations.
+ */
+
+//#include "apr.h"
+}
+{**
+ * The numeric version information is broken out into fields within this 
+ * structure. 
+ *}
+type
+  Papr_version_t = ^apr_version_t;
+  apr_version_t = record
+    major,               //**< major number */
+    minor,               //**< minor number */
+    patch,               //**< patch number */
+    is_dev: Integer;     //**< is development (1 or 0) */
+  end; {apr_version_t}
+
+{**
+ * Return APR's version information information in a numeric form.
+ *
+ *  @param pvsn Pointer to a version structure for returning the version
+ *              information.
+ *}
+//APR_DECLARE(void) apr_version(apr_version_t *pvsn);
+procedure apr_version(pvsn: Papr_version_t);
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibAPR name LibNamePrefix + 'apr_version' + LibSuff4;
+
+//** Return APR's version information as a string. */
+//APR_DECLARE(const char *) apr_version_string(void);
+function apr_version_string: PChar;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibAPR name LibNamePrefix + 'apr_version_string' + LibSuff0;
+
+
+//#endif /* ndef APR_VERSION_ONLY */
+
+//#endif /* ndef APR_VERSION_H */

+ 1654 - 0
packages/httpd24/src/aprutil/apr_buckets.inc

@@ -0,0 +1,1654 @@
+{* 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.
+ *}
+{**
+ * @file apr_buckets.h
+ * @brief APR-UTIL Buckets/Bucket Brigades
+ *}
+{
+#ifndef APR_BUCKETS_H
+#define APR_BUCKETS_H
+
+#if defined(APR_BUCKET_DEBUG) && !defined(APR_RING_DEBUG)
+#define APR_RING_DEBUG
+#endif
+
+#include "apu.h"
+#include "apr_network_io.h"
+#include "apr_file_io.h"
+#include "apr_general.h"
+#include "apr_mmap.h"
+#include "apr_errno.h"
+#include "apr_ring.h"
+#include "apr.h"
+#if APR_HAVE_SYS_UIO_H
+#include <sys/uio.h>	/* for struct iovec */
+#endif
+#if APR_HAVE_STDARG_H
+#include <stdarg.h>
+#endif
+}
+(**
+ * @defgroup APR_Util_Bucket_Brigades Bucket Brigades
+ * @ingroup APR_Util
+ * @{ 
+ *)
+
+const
+//** default bucket buffer size - 8KB minus room for memory allocator headers */
+  APR_BUCKET_BUFF_SIZE = 8000;
+
+//** Determines how a bucket or brigade should be read */
+type
+  apr_read_type_e = (
+    APR_BLOCK_READ,   //**< block until data becomes available */
+    APR_NONBLOCK_READ //**< return immediately if no data is available */
+  );
+
+{**
+ * The one-sentence buzzword-laden overview: Bucket brigades represent
+ * a complex data stream that can be passed through a layered IO
+ * system without unnecessary copying. A longer overview follows...
+ *
+ * A bucket brigade is a doubly linked list (ring) of buckets, so we
+ * aren't limited to inserting at the front and removing at the end.
+ * Buckets are only passed around as members of a brigade, although
+ * singleton buckets can occur for short periods of time.
+ *
+ * Buckets are data stores of various types. They can refer to data in
+ * memory, or part of a file or mmap area, or the output of a process,
+ * etc. Buckets also have some type-dependent accessor functions:
+ * read, split, copy, setaside, and destroy.
+ *
+ * read returns the address and size of the data in the bucket. If the
+ * data isn't in memory then it is read in and the bucket changes type
+ * so that it can refer to the new location of the data. If all the
+ * data doesn't fit in the bucket then a new bucket is inserted into
+ * the brigade to hold the rest of it.
+ *
+ * split divides the data in a bucket into two regions. After a split
+ * the original bucket refers to the first part of the data and a new
+ * bucket inserted into the brigade after the original bucket refers
+ * to the second part of the data. Reference counts are maintained as
+ * necessary.
+ *
+ * setaside ensures that the data in the bucket has a long enough
+ * lifetime. Sometimes it is convenient to create a bucket referring
+ * to data on the stack in the expectation that it will be consumed
+ * (output to the network) before the stack is unwound. If that
+ * expectation turns out not to be valid, the setaside function is
+ * called to move the data somewhere safer.
+ *
+ * copy makes a duplicate of the bucket structure as long as it's
+ * possible to have multiple references to a single copy of the
+ * data itself.  Not all bucket types can be copied.
+ *
+ * destroy maintains the reference counts on the resources used by a
+ * bucket and frees them if necessary.
+ *
+ * Note: all of the above functions have wrapper macros (apr_bucket_read(),
+ * apr_bucket_destroy(), etc), and those macros should be used rather
+ * than using the function pointers directly.
+ *
+ * To write a bucket brigade, they are first made into an iovec, so that we
+ * don't write too little data at one time.  Currently we ignore compacting the
+ * buckets into as few buckets as possible, but if we really want good
+ * performance, then we need to compact the buckets before we convert to an
+ * iovec, or possibly while we are converting to an iovec.
+ *}
+
+{*
+ * Forward declaration of the main types.
+ *}
+
+//** @see apr_bucket_brigade */
+//typedef struct apr_bucket_brigade apr_bucket_brigade;
+Papr_bucket_brigade = ^apr_bucket_brigade;
+PPapr_bucket_brigade = ^Papr_bucket_brigade;
+
+//** @see apr_bucket */
+//typedef struct apr_bucket apr_bucket;
+Papr_bucket = ^apr_bucket;
+PPapr_bucket = ^Papr_bucket;
+
+//** @see apr_bucket_alloc_t */
+//typedef struct apr_bucket_alloc_t apr_bucket_alloc_t;
+apr_bucket_alloc_t = record end;
+Papr_bucket_alloc_t = ^apr_bucket_alloc_t;
+
+//** @see apr_bucket_type_t */
+//typedef struct apr_bucket_type_t apr_bucket_type_t;
+Papr_bucket_type_t = ^apr_bucket_type_t;
+
+{from below}
+is_metadata = (
+  //** This bucket type represents actual data to send to the client. */
+  APR_BUCKET_DATA = 0,
+  //** This bucket type represents metadata. */
+  APR_BUCKET_METADATA = 1
+);
+
+//    void ( *destroy)(void *data);
+  destroy_t = procedure(data: Pointer);
+
+//    apr_status_t ( *read)(apr_bucket *b, const char **str, apr_size_t *len,
+//                         apr_read_type_e block);
+  read_t = function(b: Papr_bucket; const str: PPChar; len: Papr_size_t;
+                    block: apr_read_type_e): apr_status_t; cdecl;
+
+//    apr_status_t ( *setaside)(apr_bucket *e, apr_pool_t *pool);
+  setaside_t = function(e: Papr_bucket; pool: Papr_pool_t): apr_status_t; cdecl;
+
+//    apr_status_t ( *split)(apr_bucket *e, apr_size_t point);
+  split_t = function(e: Papr_bucket; point: apr_size_t): apr_status_t; cdecl;
+
+//    apr_status_t ( *copy)(apr_bucket *e, apr_bucket **c);
+  copy_t = function(e: Papr_bucket; c: PPapr_bucket): apr_status_t; cdecl;
+{/from below }
+
+{**
+ * Basic bucket type
+ *}
+  apr_bucket_type_t = record
+    {**
+     * The name of the bucket type
+     *}
+    name: PChar;
+    {**
+     * The number of functions this bucket understands.  Can not be less than
+     * five.
+     *}
+    num_func: Integer;
+    {**
+     * Whether the bucket contains metadata (ie, information that
+     * describes the regular contents of the brigade).  The metadata
+     * is not returned by apr_bucket_read() and is not indicated by
+     * the ->length of the apr_bucket itself.  In other words, an
+     * empty bucket is safe to arbitrarily remove if and only if it
+     * contains no metadata.  In this sense, "data" is just raw bytes
+     * that are the "content" of the brigade and "metadata" describes
+     * that data but is not a proper part of it.
+     *}
+{is_metadata is moved up}
+//    enum {
+//        /** This bucket type represents actual data to send to the client. */
+//        APR_BUCKET_DATA = 0,
+//        /** This bucket type represents metadata. */
+//        APR_BUCKET_METADATA = 1
+//    } is_metadata;
+    {**
+     * Free the private data and any resources used by the bucket (if they
+     *  aren't shared with another bucket).  This function is required to be
+     *  implemented for all bucket types, though it might be a no-op on some
+     *  of them (namely ones that never allocate any private data structures).
+     * @param data The private data pointer from the bucket to be destroyed
+     *}
+//    void ( *destroy)(void *data);
+    destroy: destroy_t;
+
+    {**
+     * Read the data from the bucket. This is required to be implemented
+     *  for all bucket types.
+     * @param b The bucket to read from
+     * @param str A place to store the data read.  Allocation should only be
+     *            done if absolutely necessary. 
+     * @param len The amount of data read.
+     * @param block Should this read function block if there is more data that
+     *              cannot be read immediately.
+     *}
+//    apr_status_t ( *read)(apr_bucket *b, const char **str, apr_size_t *len,
+//                         apr_read_type_e block);
+    read: read_t;
+
+    {**
+     * Make it possible to set aside the data for at least as long as the
+     *  given pool. Buckets containing data that could potentially die before
+     *  this pool (e.g. the data resides on the stack, in a child pool of
+     *  the given pool, or in a disjoint pool) must somehow copy, shift, or
+     *  transform the data to have the proper lifetime.
+     * @param e The bucket to convert
+     * @remark Some bucket types contain data that will always outlive the
+     *         bucket itself. For example no data (EOS and FLUSH), or the data
+     *         resides in global, constant memory (IMMORTAL), or the data is on
+     *      the heap (HEAP). For these buckets, apr_bucket_setaside_noop can
+     *      be used.
+     *}
+//    apr_status_t ( *setaside)(apr_bucket *e, apr_pool_t *pool);
+    setaside: setaside_t;
+
+    {**
+     * Split one bucket in two at the specified position by duplicating
+     *  the bucket structure (not the data) and modifying any necessary
+     *  start/end/offset information.  If it's not possible to do this
+     *  for the bucket type (perhaps the length of the data is indeterminate,
+     *  as with pipe and socket buckets), then APR_ENOTIMPL is returned.
+     * @param e The bucket to split
+     * @param point The offset of the first byte in the new bucket
+     *}
+//    apr_status_t ( *split)(apr_bucket *e, apr_size_t point);
+    split: split_t;
+
+    {**
+     * Copy the bucket structure (not the data), assuming that this is
+     *  possible for the bucket type. If it's not, APR_ENOTIMPL is returned.
+     * @param e The bucket to copy
+     * @param c Returns a pointer to the new bucket
+     *}
+//    apr_status_t ( *copy)(apr_bucket *e, apr_bucket **c);
+    copy: copy_t;
+
+  end;{apr_bucket_type_t}
+
+{from below}
+//    void (*free)(void *e);
+  free_t = procedure(e: Pointer);
+
+  link_t = record
+    next: Papr_bucket;
+    prev: Papr_bucket;
+  end;
+
+{**
+ * apr_bucket structures are allocated on the malloc() heap and
+ * their lifetime is controlled by the parent apr_bucket_brigade
+ * structure. Buckets can move from one brigade to another e.g. by
+ * calling APR_BRIGADE_CONCAT(). In general the data in a bucket has
+ * the same lifetime as the bucket and is freed when the bucket is
+ * destroyed; if the data is shared by more than one bucket (e.g.
+ * after a split) the data is freed when the last bucket goes away.
+ *}
+  apr_bucket = record
+    //** Links to the rest of the brigade */
+{macro}
+//    APR_RING_ENTRY(apr_bucket) link;
+    link: link_t;
+    //** The type of bucket.  */
+    type_: Papr_bucket_type_t;
+    {** The length of the data in the bucket.  This could have been implemented
+     *  with a function, but this is an optimization, because the most
+     *  common thing to do will be to get the length.  If the length is unknown,
+     *  the value of this field will be (apr_size_t)(-1).
+     *}
+    length: apr_size_t;
+    {** The start of the data in the bucket relative to the private base
+     *  pointer.  The vast majority of bucket types allow a fixed block of
+     *  data to be referenced by multiple buckets, each bucket pointing to
+     *  a different segment of the data.  That segment starts at base+start
+     *  and ends at base+start+length.  
+     *  If the length == (apr_size_t)(-1), then start == -1.
+     *}
+    start: apr_off_t;
+    //** type-dependent data hangs off this pointer */
+    data: Pointer;
+    {**
+     * Pointer to function used to free the bucket. This function should
+     * always be defined and it should be consistent with the memory
+     * function used to allocate the bucket. For example, if malloc() is 
+     * used to allocate the bucket, this pointer should point to free().
+     * @param e Pointer to the bucket being freed
+     *}
+{moved up}
+//    void (*free)(void *e);
+    free: free_t;
+    ///** The freelist from which this bucket was allocated */
+    list: Papr_bucket_alloc_t;
+  end;{apr_bucket}
+
+{macro from below}
+//    APR_RING_HEAD(apr_bucket_list, apr_bucket) list;
+  apr_bucket_list = record
+    next: Papr_bucket;
+    prev: Papr_bucket;
+  end;
+
+//** A list of buckets */
+  apr_bucket_brigade = record
+    {** The pool to associate the brigade with.  The data is not allocated out
+     *  of the pool, but a cleanup is registered with this pool.  If the 
+     *  brigade is destroyed by some mechanism other than pool destruction,
+     *  the destroying function is responsible for killing the cleanup.
+     *}
+    p: Papr_pool_t;
+    //** The buckets in the brigade are on this list. */
+    {*
+     * The apr_bucket_list structure doesn't actually need a name tag
+     * because it has no existence independent of struct apr_bucket_brigade;
+     * the ring macros are designed so that you can leave the name tag
+     * argument empty in this situation but apparently the Windows compiler
+     * doesn't like that.
+     *}
+{macro, moved up}
+//    APR_RING_HEAD(apr_bucket_list, apr_bucket) list;
+    list: apr_bucket_list;
+    //** The freelist from which this bucket was allocated */
+    bucket_alloc: Papr_bucket_alloc_t;
+  end;{apr_bucket_brigade}
+
+
+{**
+ * Function called when a brigade should be flushed
+ *}
+//typedef apr_status_t (*apr_brigade_flush)(apr_bucket_brigade *bb, void *ctx);
+apr_brigade_flush = function(bb: Papr_bucket_brigade; ctx: Pointer): apr_status_t;
+
+(*  fpc -> big part ignored here
+{*
+ * define APR_BUCKET_DEBUG if you want your brigades to be checked for
+ * validity at every possible instant.  this will slow your code down
+ * substantially but is a very useful debugging tool.
+ *}
+#ifdef APR_BUCKET_DEBUG
+
+#define APR_BRIGADE_CHECK_CONSISTENCY(b)				\
+        APR_RING_CHECK_CONSISTENCY(&(b)->list, apr_bucket, link)
+
+#define APR_BUCKET_CHECK_CONSISTENCY(e)					\
+        APR_RING_CHECK_ELEM_CONSISTENCY((e), apr_bucket, link)
+
+#else
+/**
+ * checks the ring pointers in a bucket brigade for consistency.  an
+ * abort() will be triggered if any inconsistencies are found.
+ *   note: this is a no-op unless APR_BUCKET_DEBUG is defined.
+ * @param b The brigade
+ */
+#define APR_BRIGADE_CHECK_CONSISTENCY(b)
+/**
+ * checks the brigade a bucket is in for ring consistency.  an
+ * abort() will be triggered if any inconsistencies are found.
+ *   note: this is a no-op unless APR_BUCKET_DEBUG is defined.
+ * @param e The bucket
+ */
+#define APR_BUCKET_CHECK_CONSISTENCY(e)
+#endif
+
+
+/**
+ * Wrappers around the RING macros to reduce the verbosity of the code
+ * that handles bucket brigades.
+ */
+/**
+ * The magic pointer value that indicates the head of the brigade
+ * @remark This is used to find the beginning and end of the brigade, eg:
+ * <pre>
+ *      while (e != APR_BRIGADE_SENTINEL(b)) {
+ *          ...
+ *          e = APR_BUCKET_NEXT(e);
+ *      }
+ * </pre>
+ * @param  b The brigade
+ * @return The magic pointer value
+ */
+#define APR_BRIGADE_SENTINEL(b)	APR_RING_SENTINEL(&(b)->list, apr_bucket, link)
+
+/**
+ * Determine if the bucket brigade is empty
+ * @param b The brigade to check
+ * @return true or false
+ */
+#define APR_BRIGADE_EMPTY(b)	APR_RING_EMPTY(&(b)->list, apr_bucket, link)
+
+/**
+ * Return the first bucket in a brigade
+ * @param b The brigade to query
+ * @return The first bucket in the brigade
+ */
+#define APR_BRIGADE_FIRST(b)	APR_RING_FIRST(&(b)->list)
+/**
+ * Return the last bucket in a brigade
+ * @param b The brigade to query
+ * @return The last bucket in the brigade
+ */
+#define APR_BRIGADE_LAST(b)	APR_RING_LAST(&(b)->list)
+
+/**
+ * Insert a list of buckets at the front of a brigade
+ * @param b The brigade to add to
+ * @param e The first bucket in a list of buckets to insert
+ */
+#define APR_BRIGADE_INSERT_HEAD(b, e) do {				\
+	apr_bucket *ap__b = (e);                                        \
+	APR_RING_INSERT_HEAD(&(b)->list, ap__b, apr_bucket, link);	\
+        APR_BRIGADE_CHECK_CONSISTENCY((b));				\
+    } while (0)
+
+/**
+ * Insert a list of buckets at the end of a brigade
+ * @param b The brigade to add to
+ * @param e The first bucket in a list of buckets to insert
+ */
+#define APR_BRIGADE_INSERT_TAIL(b, e) do {				\
+	apr_bucket *ap__b = (e);					\
+	APR_RING_INSERT_TAIL(&(b)->list, ap__b, apr_bucket, link);	\
+        APR_BRIGADE_CHECK_CONSISTENCY((b));				\
+    } while (0)
+
+/**
+ * Concatenate brigade b onto the end of brigade a, leaving brigade b empty
+ * @param a The first brigade
+ * @param b The second brigade
+ */
+#define APR_BRIGADE_CONCAT(a, b) do {					\
+        APR_RING_CONCAT(&(a)->list, &(b)->list, apr_bucket, link);	\
+        APR_BRIGADE_CHECK_CONSISTENCY((a));				\
+    } while (0)
+
+/**
+ * Prepend brigade b onto the beginning of brigade a, leaving brigade b empty
+ * @param a The first brigade
+ * @param b The second brigade
+ */
+#define APR_BRIGADE_PREPEND(a, b) do {					\
+        APR_RING_PREPEND(&(a)->list, &(b)->list, apr_bucket, link);	\
+        APR_BRIGADE_CHECK_CONSISTENCY((a));				\
+    } while (0)
+
+/**
+ * Insert a list of buckets before a specified bucket
+ * @param a The bucket to insert before
+ * @param b The buckets to insert
+ */
+#define APR_BUCKET_INSERT_BEFORE(a, b) do {				\
+	apr_bucket *ap__a = (a), *ap__b = (b);				\
+	APR_RING_INSERT_BEFORE(ap__a, ap__b, link);			\
+        APR_BUCKET_CHECK_CONSISTENCY(ap__a);				\
+    } while (0)
+
+/**
+ * Insert a list of buckets after a specified bucket
+ * @param a The bucket to insert after
+ * @param b The buckets to insert
+ */
+#define APR_BUCKET_INSERT_AFTER(a, b) do {				\
+	apr_bucket *ap__a = (a), *ap__b = (b);				\
+	APR_RING_INSERT_AFTER(ap__a, ap__b, link);			\
+        APR_BUCKET_CHECK_CONSISTENCY(ap__a);				\
+    } while (0)
+
+/**
+ * Get the next bucket in the list
+ * @param e The current bucket
+ * @return The next bucket
+ */
+#define APR_BUCKET_NEXT(e)	APR_RING_NEXT((e), link)
+/**
+ * Get the previous bucket in the list
+ * @param e The current bucket
+ * @return The previous bucket
+ */
+#define APR_BUCKET_PREV(e)	APR_RING_PREV((e), link)
+
+/**
+ * Remove a bucket from its bucket brigade
+ * @param e The bucket to remove
+ */
+#define APR_BUCKET_REMOVE(e)	APR_RING_REMOVE((e), link)
+
+/**
+ * Initialize a new bucket's prev/next pointers
+ * @param e The bucket to initialize
+ */
+#define APR_BUCKET_INIT(e)	APR_RING_ELEM_INIT((e), link)
+
+/**
+ * Determine if a bucket contains metadata.  An empty bucket is
+ * safe to arbitrarily remove if and only if this is false.
+ * @param e The bucket to inspect
+ * @return true or false
+ */
+#define APR_BUCKET_IS_METADATA(e)    ((e)->type->is_metadata)
+
+/**
+ * Determine if a bucket is a FLUSH bucket
+ * @param e The bucket to inspect
+ * @return true or false
+ */
+#define APR_BUCKET_IS_FLUSH(e)       ((e)->type == &apr_bucket_type_flush)
+/**
+ * Determine if a bucket is an EOS bucket
+ * @param e The bucket to inspect
+ * @return true or false
+ */
+#define APR_BUCKET_IS_EOS(e)         ((e)->type == &apr_bucket_type_eos)
+/**
+ * Determine if a bucket is a FILE bucket
+ * @param e The bucket to inspect
+ * @return true or false
+ */
+#define APR_BUCKET_IS_FILE(e)        ((e)->type == &apr_bucket_type_file)
+/**
+ * Determine if a bucket is a PIPE bucket
+ * @param e The bucket to inspect
+ * @return true or false
+ */
+#define APR_BUCKET_IS_PIPE(e)        ((e)->type == &apr_bucket_type_pipe)
+/**
+ * Determine if a bucket is a SOCKET bucket
+ * @param e The bucket to inspect
+ * @return true or false
+ */
+#define APR_BUCKET_IS_SOCKET(e)      ((e)->type == &apr_bucket_type_socket)
+/**
+ * Determine if a bucket is a HEAP bucket
+ * @param e The bucket to inspect
+ * @return true or false
+ */
+#define APR_BUCKET_IS_HEAP(e)        ((e)->type == &apr_bucket_type_heap)
+/**
+ * Determine if a bucket is a TRANSIENT bucket
+ * @param e The bucket to inspect
+ * @return true or false
+ */
+#define APR_BUCKET_IS_TRANSIENT(e)   ((e)->type == &apr_bucket_type_transient)
+/**
+ * Determine if a bucket is a IMMORTAL bucket
+ * @param e The bucket to inspect
+ * @return true or false
+ */
+#define APR_BUCKET_IS_IMMORTAL(e)    ((e)->type == &apr_bucket_type_immortal)
+#if APR_HAS_MMAP
+/**
+ * Determine if a bucket is a MMAP bucket
+ * @param e The bucket to inspect
+ * @return true or false
+ */
+#define APR_BUCKET_IS_MMAP(e)        ((e)->type == &apr_bucket_type_mmap)
+#endif
+/**
+ * Determine if a bucket is a POOL bucket
+ * @param e The bucket to inspect
+ * @return true or false
+ */
+#define APR_BUCKET_IS_POOL(e)        ((e)->type == &apr_bucket_type_pool)
+*)
+
+{*
+ * General-purpose reference counting for the various bucket types.
+ *
+ * Any bucket type that keeps track of the resources it uses (i.e.
+ * most of them except for IMMORTAL, TRANSIENT, and EOS) needs to
+ * attach a reference count to the resource so that it can be freed
+ * when the last bucket that uses it goes away. Resource-sharing may
+ * occur because of bucket splits or buckets that refer to globally
+ * cached data. *}
+
+//** @see apr_bucket_refcount */
+//typedef struct apr_bucket_refcount apr_bucket_refcount;
+Papr_bucket_refcount = ^apr_bucket_refcount;
+
+{**
+ * The structure used to manage the shared resource must start with an
+ * apr_bucket_refcount which is updated by the general-purpose refcount
+ * code. A pointer to the bucket-type-dependent private data structure
+ * can be cast to a pointer to an apr_bucket_refcount and vice versa.
+ *}
+ apr_bucket_refcount = record
+    //** The number of references to this bucket */
+   refcount: Integer;
+ end;
+
+//*  *****  Reference-counted bucket types  *****  */
+
+//** @see apr_bucket_heap */
+//typedef struct apr_bucket_heap apr_bucket_heap;
+Papr_bucket_heap = ^apr_bucket_heap;
+
+{from below}
+//    void (*free_func)(void *data);
+free_func_t = procedure (data: Pointer);
+
+{**
+ * A bucket referring to data allocated off the heap.
+ *}
+  apr_bucket_heap = record
+    //** Number of buckets using this memory */
+    refcount: apr_bucket_refcount;
+    {** The start of the data actually allocated.  This should never be
+     * modified, it is only used to free the bucket.
+     *}
+    base: PChar;
+    //** how much memory was allocated */
+    alloc_len: apr_size_t;
+    //** function to use to delete the data */
+//    void (*free_func)(void *data);
+    free_func: free_func_t;
+  end;{apr_bucket_heap}
+
+//** @see apr_bucket_pool */
+//typedef struct apr_bucket_pool apr_bucket_pool;
+Papr_bucket_pool = ^apr_bucket_pool;
+
+{**
+ * A bucket referring to data allocated from a pool
+ *}
+  apr_bucket_pool = record
+    {** The pool bucket must be able to be easily morphed to a heap
+     * bucket if the pool gets cleaned up before all references are
+     * destroyed.  This apr_bucket_heap structure is populated automatically
+     * when the pool gets cleaned up, and subsequent calls to pool_read()
+     * will result in the apr_bucket in question being morphed into a
+     * regular heap bucket.  (To avoid having to do many extra refcount
+     * manipulations and b->data manipulations, the apr_bucket_pool
+     * struct actually *contains* the apr_bucket_heap struct that it
+     * will become as its first element; the two share their
+     * apr_bucket_refcount members.)
+     *}
+    heap: apr_bucket_heap;
+    {** The block of data actually allocated from the pool.
+     * Segments of this block are referenced by adjusting
+     * the start and length of the apr_bucket accordingly.
+     * This will be NULL after the pool gets cleaned up.
+     *}
+    base: PChar;
+    {** The pool the data was allocated from.  When the pool
+     * is cleaned up, this gets set to NULL as an indicator
+     * to pool_read() that the data is now on the heap and
+     * so it should morph the bucket into a regular heap
+     * bucket before continuing.
+     *}
+    pool: Papr_pool_t;
+    {** The freelist this structure was allocated from, which is
+     * needed in the cleanup phase in order to allocate space on the heap
+     *}
+    list: Papr_bucket_alloc_t;
+  end;{apr_bucket_pool}
+
+//#if APR_HAS_MMAP
+///** @see apr_bucket_mmap */
+//typedef struct apr_bucket_mmap apr_bucket_mmap;
+Papr_bucket_mmap = ^apr_bucket_mmap;
+{**
+ * A bucket referring to an mmap()ed file
+ *}
+  apr_bucket_mmap = record
+    //** Number of buckets using this memory */
+    refcount: apr_bucket_refcount;
+    //** The mmap this sub_bucket refers to */
+    mmap: Papr_mmap_t;
+  end;
+//#endif
+
+//** @see apr_bucket_file */
+//typedef struct apr_bucket_file apr_bucket_file;
+Papr_bucket_file = ^apr_bucket_file;
+
+{**
+ * A bucket referring to an file
+ *}
+  apr_bucket_file = record
+    //** Number of buckets using this memory */
+    refcount: apr_bucket_refcount;
+    //** The file this bucket refers to */
+    fd: Papr_file_t;
+    {** The pool into which any needed structures should
+     *  be created while reading from this file bucket *}
+    readpool: Papr_pool_t;
+//#if APR_HAS_MMAP
+    {** Whether this bucket should be memory-mapped if
+     *  a caller tries to read from it *}
+    can_mmap: Integer;
+//#endif /* APR_HAS_MMAP */
+  end;
+
+//** @see apr_bucket_structs */
+//typedef union apr_bucket_structs apr_bucket_structs;
+Papr_bucket_structs = ^apr_bucket_structs;
+
+{**
+ * A union of all bucket structures so we know what
+ * the max size is.
+ *}
+  apr_bucket_structs = record
+    case Integer of
+      0: (b: apr_bucket);            //**< Bucket */
+      1: (heap: apr_bucket_heap);    //**< Heap */
+      2: (pool: apr_bucket_pool);    //**< Pool */
+//#if APR_HAS_MMAP
+      3: (mmap: apr_bucket_mmap);    //**< MMap */
+//#endif
+      4: (file_: apr_bucket_file);   //**< File */
+    end;
+
+(*  fpc -> Rest is ignored below
+{**
+ * The amount that apr_bucket_alloc() should allocate in the common case.
+ * Note: this is twice as big as apr_bucket_structs to allow breathing
+ * room for third-party bucket types.
+ *}
+#define APR_BUCKET_ALLOC_SIZE  APR_ALIGN_DEFAULT(2*sizeof(apr_bucket_structs))
+
+/*  *****  Bucket Brigade Functions  *****  */
+/**
+ * Create a new bucket brigade.  The bucket brigade is originally empty.
+ * @param p The pool to associate with the brigade.  Data is not allocated out
+ *          of the pool, but a cleanup is registered.
+ * @param list The bucket allocator to use
+ * @return The empty bucket brigade
+ */
+APU_DECLARE(apr_bucket_brigade * ) apr_brigade_create(apr_pool_t *p,
+                                                     apr_bucket_alloc_t *list);
+
+/**
+ * destroy an entire bucket brigade.  This includes destroying all of the
+ * buckets within the bucket brigade's bucket list. 
+ * @param b The bucket brigade to destroy
+ */
+APU_DECLARE(apr_status_t) apr_brigade_destroy(apr_bucket_brigade *b);
+
+/**
+ * empty out an entire bucket brigade.  This includes destroying all of the
+ * buckets within the bucket brigade's bucket list.  This is similar to
+ * apr_brigade_destroy(), except that it does not deregister the brigade's
+ * pool cleanup function.
+ * @param data The bucket brigade to clean up
+ * @remark Generally, you should use apr_brigade_destroy().  This function
+ *         can be useful in situations where you have a single brigade that
+ *         you wish to reuse many times by destroying all of the buckets in
+ *         the brigade and putting new buckets into it later.
+ */
+APU_DECLARE(apr_status_t) apr_brigade_cleanup(void *data);
+
+/**
+ * Move the buckets from the tail end of the existing brigade @a b into
+ * the brigade @a a. If @a a is NULL a new brigade is created. Buckets
+ * from @a e to the last bucket (inclusively) of brigade @a b are moved
+ * from @a b to the returned brigade @a a.
+ *
+ * @param b The brigade to split
+ * @param e The first bucket to move
+ * @param a The brigade which should be used for the result or NULL if
+ *          a new brigade should be created. The brigade @a a will be
+ *          cleared if it is not empty.
+ * @return The brigade supplied in @a a or a new one if @a a was NULL.
+ * @warning Note that this function allocates a new brigade if @a a is
+ * NULL so memory consumption should be carefully considered.
+ */
+APU_DECLARE(apr_bucket_brigade * ) apr_brigade_split_ex(apr_bucket_brigade *b,
+                                                       apr_bucket *e,
+                                                       apr_bucket_brigade *a);
+
+/**
+ * Create a new bucket brigade and move the buckets from the tail end
+ * of an existing brigade into the new brigade.  Buckets from 
+ * @a e to the last bucket (inclusively) of brigade @a b
+ * are moved from @a b to the returned brigade.
+ * @param b The brigade to split 
+ * @param e The first bucket to move
+ * @return The new brigade
+ * @warning Note that this function always allocates a new brigade
+ * so memory consumption should be carefully considered.
+ */
+APU_DECLARE(apr_bucket_brigade * ) apr_brigade_split(apr_bucket_brigade *b,
+                                                    apr_bucket *e);
+
+/**
+ * Partition a bucket brigade at a given offset (in bytes from the start of
+ * the brigade).  This is useful whenever a filter wants to use known ranges
+ * of bytes from the brigade; the ranges can even overlap.
+ * @param b The brigade to partition
+ * @param point The offset at which to partition the brigade
+ * @param after_point Returns a pointer to the first bucket after the partition
+ * @return APR_SUCCESS on success, APR_INCOMPLETE if the contents of the
+ * brigade were shorter than @a point, or an error code.
+ * @remark if APR_INCOMPLETE is returned, @a after_point will be set to
+ * the brigade sentinel.
+ */
+APU_DECLARE(apr_status_t) apr_brigade_partition(apr_bucket_brigade *b,
+                                                apr_off_t point,
+                                                apr_bucket **after_point);
+
+/**
+ * Return the total length of the brigade.
+ * @param bb The brigade to compute the length of
+ * @param read_all Read unknown-length buckets to force a size
+ * @param length Returns the length of the brigade (up to the end, or up
+ *               to a bucket read error), or -1 if the brigade has buckets
+ *               of indeterminate length and read_all is 0.
+ */
+APU_DECLARE(apr_status_t) apr_brigade_length(apr_bucket_brigade *bb,
+                                             int read_all,
+                                             apr_off_t *length);
+
+/**
+ * Take a bucket brigade and store the data in a flat char*
+ * @param bb The bucket brigade to create the char* from
+ * @param c The char* to write into
+ * @param len The maximum length of the char array. On return, it is the
+ *            actual length of the char array.
+ */
+APU_DECLARE(apr_status_t) apr_brigade_flatten(apr_bucket_brigade *bb,
+                                              char *c,
+                                              apr_size_t *len);
+
+/**
+ * Creates a pool-allocated string representing a flat bucket brigade
+ * @param bb The bucket brigade to create the char array from
+ * @param c On return, the allocated char array
+ * @param len On return, the length of the char array.
+ * @param pool The pool to allocate the string from.
+ */
+APU_DECLARE(apr_status_t) apr_brigade_pflatten(apr_bucket_brigade *bb, 
+                                               char **c,
+                                               apr_size_t *len,
+                                               apr_pool_t *pool);
+
+/**
+ * Split a brigade to represent one LF line.
+ * @param bbOut The bucket brigade that will have the LF line appended to.
+ * @param bbIn The input bucket brigade to search for a LF-line.
+ * @param block The blocking mode to be used to split the line.
+ * @param maxbytes The maximum bytes to read.  If this many bytes are seen
+ *                 without a LF, the brigade will contain a partial line.
+ */
+APU_DECLARE(apr_status_t) apr_brigade_split_line(apr_bucket_brigade *bbOut,
+                                                 apr_bucket_brigade *bbIn,
+                                                 apr_read_type_e block,
+                                                 apr_off_t maxbytes);
+
+/**
+ * Create an iovec of the elements in a bucket_brigade... return number 
+ * of elements used.  This is useful for writing to a file or to the
+ * network efficiently.
+ * @param b The bucket brigade to create the iovec from
+ * @param vec The iovec to create
+ * @param nvec The number of elements in the iovec. On return, it is the
+ *             number of iovec elements actually filled out.
+ */
+APU_DECLARE(apr_status_t) apr_brigade_to_iovec(apr_bucket_brigade *b, 
+                                               struct iovec *vec, int *nvec);
+
+/**
+ * This function writes a list of strings into a bucket brigade. 
+ * @param b The bucket brigade to add to
+ * @param flush The flush function to use if the brigade is full
+ * @param ctx The structure to pass to the flush function
+ * @param va A list of strings to add
+ * @return APR_SUCCESS or error code.
+ */
+APU_DECLARE(apr_status_t) apr_brigade_vputstrs(apr_bucket_brigade *b,
+                                               apr_brigade_flush flush,
+                                               void *ctx,
+                                               va_list va);
+
+/**
+ * This function writes a string into a bucket brigade.
+ *
+ * The apr_brigade_write function attempts to be efficient with the
+ * handling of heap buckets. Regardless of the amount of data stored
+ * inside a heap bucket, heap buckets are a fixed size to promote their
+ * reuse.
+ *
+ * If an attempt is made to write a string to a brigade that already 
+ * ends with a heap bucket, this function will attempt to pack the
+ * string into the remaining space in the previous heap bucket, before
+ * allocating a new heap bucket.
+ *
+ * This function always returns APR_SUCCESS, unless a flush function is
+ * passed, in which case the return value of the flush function will be
+ * returned if used.
+ * @param b The bucket brigade to add to
+ * @param flush The flush function to use if the brigade is full
+ * @param ctx The structure to pass to the flush function
+ * @param str The string to add
+ * @param nbyte The number of bytes to write
+ * @return APR_SUCCESS or error code
+ */
+APU_DECLARE(apr_status_t) apr_brigade_write(apr_bucket_brigade *b,
+                                            apr_brigade_flush flush, void *ctx,
+                                            const char *str, apr_size_t nbyte);
+
+/**
+ * This function writes multiple strings into a bucket brigade.
+ * @param b The bucket brigade to add to
+ * @param flush The flush function to use if the brigade is full
+ * @param ctx The structure to pass to the flush function
+ * @param vec The strings to add (address plus length for each)
+ * @param nvec The number of entries in iovec
+ * @return APR_SUCCESS or error code
+ */
+APU_DECLARE(apr_status_t) apr_brigade_writev(apr_bucket_brigade *b,
+                                             apr_brigade_flush flush,
+                                             void *ctx,
+                                             const struct iovec *vec,
+                                             apr_size_t nvec);
+
+/**
+ * This function writes a string into a bucket brigade.
+ * @param bb The bucket brigade to add to
+ * @param flush The flush function to use if the brigade is full
+ * @param ctx The structure to pass to the flush function
+ * @param str The string to add
+ * @return APR_SUCCESS or error code
+ */
+APU_DECLARE(apr_status_t) apr_brigade_puts(apr_bucket_brigade *bb,
+                                           apr_brigade_flush flush, void *ctx,
+                                           const char *str);
+
+/**
+ * This function writes a character into a bucket brigade.
+ * @param b The bucket brigade to add to
+ * @param flush The flush function to use if the brigade is full
+ * @param ctx The structure to pass to the flush function
+ * @param c The character to add
+ * @return APR_SUCCESS or error code
+ */
+APU_DECLARE(apr_status_t) apr_brigade_putc(apr_bucket_brigade *b,
+                                           apr_brigade_flush flush, void *ctx,
+                                           const char c);
+
+/**
+ * This function writes an unspecified number of strings into a bucket brigade.
+ * @param b The bucket brigade to add to
+ * @param flush The flush function to use if the brigade is full
+ * @param ctx The structure to pass to the flush function
+ * @param ... The strings to add
+ * @return APR_SUCCESS or error code
+ */
+APU_DECLARE_NONSTD(apr_status_t) apr_brigade_putstrs(apr_bucket_brigade *b,
+                                                     apr_brigade_flush flush,
+                                                     void *ctx, ...);
+
+/**
+ * Evaluate a printf and put the resulting string at the end 
+ * of the bucket brigade.
+ * @param b The brigade to write to
+ * @param flush The flush function to use if the brigade is full
+ * @param ctx The structure to pass to the flush function
+ * @param fmt The format of the string to write
+ * @param ... The arguments to fill out the format
+ * @return APR_SUCCESS or error code
+ */
+APU_DECLARE_NONSTD(apr_status_t) apr_brigade_printf(apr_bucket_brigade *b, 
+                                                    apr_brigade_flush flush,
+                                                    void *ctx,
+                                                    const char *fmt, ...)
+        __attribute__((format(printf,4,5)));
+
+/**
+ * Evaluate a printf and put the resulting string at the end 
+ * of the bucket brigade.
+ * @param b The brigade to write to
+ * @param flush The flush function to use if the brigade is full
+ * @param ctx The structure to pass to the flush function
+ * @param fmt The format of the string to write
+ * @param va The arguments to fill out the format
+ * @return APR_SUCCESS or error code
+ */
+APU_DECLARE(apr_status_t) apr_brigade_vprintf(apr_bucket_brigade *b, 
+                                              apr_brigade_flush flush,
+                                              void *ctx,
+                                              const char *fmt, va_list va);
+
+/**
+ * Utility function to insert a file (or a segment of a file) onto the
+ * end of the brigade.  The file is split into multiple buckets if it
+ * is larger than the maximum size which can be represented by a
+ * single bucket.
+ * @param bb the brigade to insert into
+ * @param f the file to insert
+ * @param start the offset of the start of the segment
+ * @param len the length of the segment of the file to insert
+ * @param p pool from which file buckets are allocated
+ * @return the last bucket inserted
+ */
+APU_DECLARE(apr_bucket * ) apr_brigade_insert_file(apr_bucket_brigade *bb,
+                                                  apr_file_t *f,
+                                                  apr_off_t start,
+                                                  apr_off_t len,
+                                                  apr_pool_t *p);
+
+
+
+/*  *****  Bucket freelist functions *****  */
+/**
+ * Create a bucket allocator.
+ * @param p This pool's underlying apr_allocator_t is used to allocate memory
+ *          for the bucket allocator.  When the pool is destroyed, the bucket
+ *          allocator's cleanup routine will free all memory that has been
+ *          allocated from it.
+ * @remark  The reason the allocator gets its memory from the pool's
+ *          apr_allocator_t rather than from the pool itself is because
+ *          the bucket allocator will free large memory blocks back to the
+ *          allocator when it's done with them, thereby preventing memory
+ *          footprint growth that would occur if we allocated from the pool.
+ * @warning The allocator must never be used by more than one thread at a time.
+ */
+APU_DECLARE_NONSTD(apr_bucket_alloc_t * ) apr_bucket_alloc_create(apr_pool_t *p);
+
+/**
+ * Create a bucket allocator.
+ * @param allocator This apr_allocator_t is used to allocate both the bucket
+ *          allocator and all memory handed out by the bucket allocator.  The
+ *          caller is responsible for destroying the bucket allocator and the
+ *          apr_allocator_t -- no automatic cleanups will happen.
+ * @warning The allocator must never be used by more than one thread at a time.
+ */
+APU_DECLARE_NONSTD(apr_bucket_alloc_t * ) apr_bucket_alloc_create_ex(apr_allocator_t *allocator);
+
+/**
+ * Destroy a bucket allocator.
+ * @param list The allocator to be destroyed
+ */
+APU_DECLARE_NONSTD(void) apr_bucket_alloc_destroy(apr_bucket_alloc_t *list);
+
+/**
+ * Allocate memory for use by the buckets.
+ * @param size The amount to allocate.
+ * @param list The allocator from which to allocate the memory.
+ */
+APU_DECLARE_NONSTD(void * ) apr_bucket_alloc(apr_size_t size, apr_bucket_alloc_t *list);
+
+/**
+ * Free memory previously allocated with apr_bucket_alloc().
+ * @param block The block of memory to be freed.
+ */
+APU_DECLARE_NONSTD(void) apr_bucket_free(void *block);
+
+
+/*  *****  Bucket Functions  *****  */
+/**
+ * Free the resources used by a bucket. If multiple buckets refer to
+ * the same resource it is freed when the last one goes away.
+ * @see apr_bucket_delete()
+ * @param e The bucket to destroy
+ */
+#define apr_bucket_destroy(e) do {					\
+        (e)->type->destroy((e)->data);					\
+        (e)->free(e);							\
+    } while (0)
+
+/**
+ * Delete a bucket by removing it from its brigade (if any) and then
+ * destroying it.
+ * @remark This mainly acts as an aid in avoiding code verbosity.  It is
+ * the preferred exact equivalent to:
+ * <pre>
+ *      APR_BUCKET_REMOVE(e);
+ *      apr_bucket_destroy(e);
+ * </pre>
+ * @param e The bucket to delete
+ */
+#define apr_bucket_delete(e) do {					\
+        APR_BUCKET_REMOVE(e);						\
+        apr_bucket_destroy(e);						\
+    } while (0)
+
+/**
+ * Read some data from the bucket.
+ *
+ * The apr_bucket_read function returns a convenient amount of data
+ * from the bucket provided, writing the address and length of the
+ * data to the pointers provided by the caller. The function tries
+ * as hard as possible to avoid a memory copy.
+ *
+ * Buckets are expected to be a member of a brigade at the time they
+ * are read.
+ *
+ * In typical application code, buckets are read in a loop, and after
+ * each bucket is read and processed, it is moved or deleted from the
+ * brigade and the next bucket read.
+ *
+ * The definition of "convenient" depends on the type of bucket that
+ * is being read, and is decided by APR. In the case of memory based
+ * buckets such as heap and immortal buckets, a pointer will be
+ * returned to the location of the buffer containing the complete
+ * contents of the bucket.
+ *
+ * Some buckets, such as the socket bucket, might have no concept
+ * of length. If an attempt is made to read such a bucket, the
+ * apr_bucket_read function will read a convenient amount of data
+ * from the socket. The socket bucket is magically morphed into a
+ * heap bucket containing the just-read data, and a new socket bucket
+ * is inserted just after this heap bucket.
+ *
+ * To understand why apr_bucket_read might do this, consider the loop
+ * described above to read and process buckets. The current bucket
+ * is magically morphed into a heap bucket and returned to the caller.
+ * The caller processes the data, and deletes the heap bucket, moving
+ * onto the next bucket, the new socket bucket. This process repeats,
+ * giving the illusion of a bucket brigade that contains potentially
+ * infinite amounts of data. It is up to the caller to decide at what
+ * point to stop reading buckets.
+ *
+ * Some buckets, such as the file bucket, might have a fixed size,
+ * but be significantly larger than is practical to store in RAM in
+ * one go. As with the socket bucket, if an attempt is made to read
+ * from a file bucket, the file bucket is magically morphed into a
+ * heap bucket containing a convenient amount of data read from the
+ * current offset in the file. During the read, the offset will be
+ * moved forward on the file, and a new file bucket will be inserted
+ * directly after the current bucket representing the remainder of the
+ * file. If the heap bucket was large enough to store the whole
+ * remainder of the file, no more file buckets are inserted, and the
+ * file bucket will disappear completely.
+ *
+ * The pattern for reading buckets described above does create the
+ * illusion that the code is willing to swallow buckets that might be
+ * too large for the system to handle in one go. This however is just
+ * an illusion: APR will always ensure that large (file) or infinite
+ * (socket) buckets are broken into convenient bite sized heap buckets
+ * before data is returned to the caller.
+ *
+ * There is a potential gotcha to watch for: if buckets are read in a
+ * loop, and aren't deleted after being processed, the potentially large
+ * bucket will slowly be converted into RAM resident heap buckets. If
+ * the file is larger than available RAM, an out of memory condition
+ * could be caused if the application is not careful to manage this.
+ *
+ * @param e The bucket to read from
+ * @param str The location to store a pointer to the data in
+ * @param len The location to store the amount of data read
+ * @param block Whether the read function blocks
+ */
+#define apr_bucket_read(e,str,len,block) (e)->type->read(e, str, len, block)
+
+/**
+ * Setaside data so that stack data is not destroyed on returning from
+ * the function
+ * @param e The bucket to setaside
+ * @param p The pool to setaside into
+ */
+#define apr_bucket_setaside(e,p) (e)->type->setaside(e,p)
+
+/**
+ * Split one bucket in two at the point provided.
+ * 
+ * Once split, the original bucket becomes the first of the two new buckets.
+ * 
+ * (It is assumed that the bucket is a member of a brigade when this
+ * function is called).
+ * @param e The bucket to split
+ * @param point The offset to split the bucket at
+ */
+#define apr_bucket_split(e,point) (e)->type->split(e, point)
+
+/**
+ * Copy a bucket.
+ * @param e The bucket to copy
+ * @param c Returns a pointer to the new bucket
+ */
+#define apr_bucket_copy(e,c) (e)->type->copy(e, c)
+
+/* Bucket type handling */
+
+/**
+ * This function simply returns APR_SUCCESS to denote that the bucket does
+ * not require anything to happen for its setaside() function. This is
+ * appropriate for buckets that have "immortal" data -- the data will live
+ * at least as long as the bucket.
+ * @param data The bucket to setaside
+ * @param pool The pool defining the desired lifetime of the bucket data
+ * @return APR_SUCCESS
+ */ 
+APU_DECLARE_NONSTD(apr_status_t) apr_bucket_setaside_noop(apr_bucket *data,
+                                                          apr_pool_t *pool);
+
+/**
+ * A place holder function that signifies that the setaside function was not
+ * implemented for this bucket
+ * @param data The bucket to setaside
+ * @param pool The pool defining the desired lifetime of the bucket data
+ * @return APR_ENOTIMPL
+ */ 
+APU_DECLARE_NONSTD(apr_status_t) apr_bucket_setaside_notimpl(apr_bucket *data,
+                                                             apr_pool_t *pool);
+
+/**
+ * A place holder function that signifies that the split function was not
+ * implemented for this bucket
+ * @param data The bucket to split
+ * @param point The location to split the bucket
+ * @return APR_ENOTIMPL
+ */ 
+APU_DECLARE_NONSTD(apr_status_t) apr_bucket_split_notimpl(apr_bucket *data,
+                                                          apr_size_t point);
+
+/**
+ * A place holder function that signifies that the copy function was not
+ * implemented for this bucket
+ * @param e The bucket to copy
+ * @param c Returns a pointer to the new bucket
+ * @return APR_ENOTIMPL
+ */
+APU_DECLARE_NONSTD(apr_status_t) apr_bucket_copy_notimpl(apr_bucket *e,
+                                                         apr_bucket **c);
+
+/**
+ * A place holder function that signifies that this bucket does not need
+ * to do anything special to be destroyed.  That's only the case for buckets
+ * that either have no data (metadata buckets) or buckets whose data pointer
+ * points to something that's not a bucket-type-specific structure, as with
+ * simple buckets where data points to a string and pipe buckets where data
+ * points directly to the apr_file_t.
+ * @param data The bucket data to destroy
+ */ 
+APU_DECLARE_NONSTD(void) apr_bucket_destroy_noop(void *data);
+
+/**
+ * There is no apr_bucket_destroy_notimpl, because destruction is required
+ * to be implemented (it could be a noop, but only if that makes sense for
+ * the bucket type)
+ */
+
+/* There is no apr_bucket_read_notimpl, because it is a required function
+ */
+
+
+/* All of the bucket types implemented by the core */
+/**
+ * The flush bucket type.  This signifies that all data should be flushed to
+ * the next filter.  The flush bucket should be sent with the other buckets.
+ */
+APU_DECLARE_DATA extern const apr_bucket_type_t apr_bucket_type_flush;
+/**
+ * The EOS bucket type.  This signifies that there will be no more data, ever.
+ * All filters MUST send all data to the next filter when they receive a
+ * bucket of this type
+ */
+APU_DECLARE_DATA extern const apr_bucket_type_t apr_bucket_type_eos;
+/**
+ * The FILE bucket type.  This bucket represents a file on disk
+ */
+APU_DECLARE_DATA extern const apr_bucket_type_t apr_bucket_type_file;
+/**
+ * The HEAP bucket type.  This bucket represents a data allocated from the
+ * heap.
+ */
+APU_DECLARE_DATA extern const apr_bucket_type_t apr_bucket_type_heap;
+#if APR_HAS_MMAP
+/**
+ * The MMAP bucket type.  This bucket represents an MMAP'ed file
+ */
+APU_DECLARE_DATA extern const apr_bucket_type_t apr_bucket_type_mmap;
+#endif
+/**
+ * The POOL bucket type.  This bucket represents a data that was allocated
+ * from a pool.  IF this bucket is still available when the pool is cleared,
+ * the data is copied on to the heap.
+ */
+APU_DECLARE_DATA extern const apr_bucket_type_t apr_bucket_type_pool;
+/**
+ * The PIPE bucket type.  This bucket represents a pipe to another program.
+ */
+APU_DECLARE_DATA extern const apr_bucket_type_t apr_bucket_type_pipe;
+/**
+ * The IMMORTAL bucket type.  This bucket represents a segment of data that
+ * the creator is willing to take responsibility for.  The core will do
+ * nothing with the data in an immortal bucket
+ */
+APU_DECLARE_DATA extern const apr_bucket_type_t apr_bucket_type_immortal;
+/**
+ * The TRANSIENT bucket type.  This bucket represents a data allocated off
+ * the stack.  When the setaside function is called, this data is copied on
+ * to the heap
+ */
+APU_DECLARE_DATA extern const apr_bucket_type_t apr_bucket_type_transient;
+/**
+ * The SOCKET bucket type.  This bucket represents a socket to another machine
+ */
+APU_DECLARE_DATA extern const apr_bucket_type_t apr_bucket_type_socket;
+
+
+/*  *****  Simple buckets  *****  */
+
+/**
+ * Split a simple bucket into two at the given point.  Most non-reference
+ * counting buckets that allow multiple references to the same block of
+ * data (eg transient and immortal) will use this as their split function
+ * without any additional type-specific handling.
+ * @param b The bucket to be split
+ * @param point The offset of the first byte in the new bucket
+ * @return APR_EINVAL if the point is not within the bucket;
+ *         APR_ENOMEM if allocation failed;
+ *         or APR_SUCCESS
+ */
+APU_DECLARE_NONSTD(apr_status_t) apr_bucket_simple_split(apr_bucket *b,
+                                                         apr_size_t point);
+
+/**
+ * Copy a simple bucket.  Most non-reference-counting buckets that allow
+ * multiple references to the same block of data (eg transient and immortal)
+ * will use this as their copy function without any additional type-specific
+ * handling.
+ * @param a The bucket to copy
+ * @param b Returns a pointer to the new bucket
+ * @return APR_ENOMEM if allocation failed;
+ *         or APR_SUCCESS
+ */
+APU_DECLARE_NONSTD(apr_status_t) apr_bucket_simple_copy(apr_bucket *a,
+                                                        apr_bucket **b);
+
+
+/*  *****  Shared, reference-counted buckets  *****  */
+
+/**
+ * Initialize a bucket containing reference-counted data that may be
+ * shared. The caller must allocate the bucket if necessary and
+ * initialize its type-dependent fields, and allocate and initialize
+ * its own private data structure. This function should only be called
+ * by type-specific bucket creation functions.
+ * @param b The bucket to initialize
+ * @param data A pointer to the private data structure
+ *             with the reference count at the start
+ * @param start The start of the data in the bucket
+ *              relative to the private base pointer
+ * @param length The length of the data in the bucket
+ * @return The new bucket, or NULL if allocation failed
+ */
+APU_DECLARE(apr_bucket * ) apr_bucket_shared_make(apr_bucket *b, void *data,
+				                 apr_off_t start, 
+                                                 apr_size_t length);
+
+/**
+ * Decrement the refcount of the data in the bucket. This function
+ * should only be called by type-specific bucket destruction functions.
+ * @param data The private data pointer from the bucket to be destroyed
+ * @return TRUE or FALSE; TRUE if the reference count is now
+ *         zero, indicating that the shared resource itself can
+ *         be destroyed by the caller.
+ */
+APU_DECLARE(int) apr_bucket_shared_destroy(void *data);
+
+/**
+ * Split a bucket into two at the given point, and adjust the refcount
+ * to the underlying data. Most reference-counting bucket types will
+ * be able to use this function as their split function without any
+ * additional type-specific handling.
+ * @param b The bucket to be split
+ * @param point The offset of the first byte in the new bucket
+ * @return APR_EINVAL if the point is not within the bucket;
+ *         APR_ENOMEM if allocation failed;
+ *         or APR_SUCCESS
+ */
+APU_DECLARE_NONSTD(apr_status_t) apr_bucket_shared_split(apr_bucket *b,
+                                                         apr_size_t point);
+
+/**
+ * Copy a refcounted bucket, incrementing the reference count. Most
+ * reference-counting bucket types will be able to use this function
+ * as their copy function without any additional type-specific handling.
+ * @param a The bucket to copy
+ * @param b Returns a pointer to the new bucket
+ * @return APR_ENOMEM if allocation failed;
+           or APR_SUCCESS
+ */
+APU_DECLARE_NONSTD(apr_status_t) apr_bucket_shared_copy(apr_bucket *a,
+                                                        apr_bucket **b);
+
+
+/*  *****  Functions to Create Buckets of varying types  *****  */
+/*
+ * Each bucket type foo has two initialization functions:
+ * apr_bucket_foo_make which sets up some already-allocated memory as a
+ * bucket of type foo; and apr_bucket_foo_create which allocates memory
+ * for the bucket, calls apr_bucket_make_foo, and initializes the
+ * bucket's list pointers. The apr_bucket_foo_make functions are used
+ * inside the bucket code to change the type of buckets in place;
+ * other code should call apr_bucket_foo_create. All the initialization
+ * functions change nothing if they fail.
+ */
+
+/**
+ * Create an End of Stream bucket.  This indicates that there is no more data
+ * coming from down the filter stack.  All filters should flush at this point.
+ * @param list The freelist from which this bucket should be allocated
+ * @return The new bucket, or NULL if allocation failed
+ */
+APU_DECLARE(apr_bucket * ) apr_bucket_eos_create(apr_bucket_alloc_t *list);
+
+/**
+ * Make the bucket passed in an EOS bucket.  This indicates that there is no 
+ * more data coming from down the filter stack.  All filters should flush at 
+ * this point.
+ * @param b The bucket to make into an EOS bucket
+ * @return The new bucket, or NULL if allocation failed
+ */
+APU_DECLARE(apr_bucket * ) apr_bucket_eos_make(apr_bucket *b);
+
+/**
+ * Create a flush  bucket.  This indicates that filters should flush their
+ * data.  There is no guarantee that they will flush it, but this is the
+ * best we can do.
+ * @param list The freelist from which this bucket should be allocated
+ * @return The new bucket, or NULL if allocation failed
+ */
+APU_DECLARE(apr_bucket * ) apr_bucket_flush_create(apr_bucket_alloc_t *list);
+
+/**
+ * Make the bucket passed in a FLUSH  bucket.  This indicates that filters 
+ * should flush their data.  There is no guarantee that they will flush it, 
+ * but this is the best we can do.
+ * @param b The bucket to make into a FLUSH bucket
+ * @return The new bucket, or NULL if allocation failed
+ */
+APU_DECLARE(apr_bucket * ) apr_bucket_flush_make(apr_bucket *b);
+
+/**
+ * Create a bucket referring to long-lived data.
+ * @param buf The data to insert into the bucket
+ * @param nbyte The size of the data to insert.
+ * @param list The freelist from which this bucket should be allocated
+ * @return The new bucket, or NULL if allocation failed
+ */
+APU_DECLARE(apr_bucket * ) apr_bucket_immortal_create(const char *buf,
+                                                     apr_size_t nbyte,
+                                                     apr_bucket_alloc_t *list);
+
+/**
+ * Make the bucket passed in a bucket refer to long-lived data
+ * @param b The bucket to make into a IMMORTAL bucket
+ * @param buf The data to insert into the bucket
+ * @param nbyte The size of the data to insert.
+ * @return The new bucket, or NULL if allocation failed
+ */
+APU_DECLARE(apr_bucket * ) apr_bucket_immortal_make(apr_bucket *b,
+                                                   const char *buf, 
+                                                   apr_size_t nbyte);
+
+/**
+ * Create a bucket referring to data on the stack.
+ * @param buf The data to insert into the bucket
+ * @param nbyte The size of the data to insert.
+ * @param list The freelist from which this bucket should be allocated
+ * @return The new bucket, or NULL if allocation failed
+ */
+APU_DECLARE(apr_bucket * ) apr_bucket_transient_create(const char *buf,
+                                                      apr_size_t nbyte,
+                                                      apr_bucket_alloc_t *list);
+
+/**
+ * Make the bucket passed in a bucket refer to stack data
+ * @param b The bucket to make into a TRANSIENT bucket
+ * @param buf The data to insert into the bucket
+ * @param nbyte The size of the data to insert.
+ * @return The new bucket, or NULL if allocation failed
+ */
+APU_DECLARE(apr_bucket * ) apr_bucket_transient_make(apr_bucket *b,
+                                                    const char *buf,
+                                                    apr_size_t nbyte);
+
+/**
+ * Create a bucket referring to memory on the heap. If the caller asks
+ * for the data to be copied, this function always allocates 4K of
+ * memory so that more data can be added to the bucket without
+ * requiring another allocation. Therefore not all the data may be put
+ * into the bucket. If copying is not requested then the bucket takes
+ * over responsibility for free()ing the memory.
+ * @param buf The buffer to insert into the bucket
+ * @param nbyte The size of the buffer to insert.
+ * @param free_func Function to use to free the data; NULL indicates that the
+ *                  bucket should make a copy of the data
+ * @param list The freelist from which this bucket should be allocated
+ * @return The new bucket, or NULL if allocation failed
+ */
+APU_DECLARE(apr_bucket * ) apr_bucket_heap_create(const char *buf,
+                                                 apr_size_t nbyte,
+                                                 void ( *free_func)(void *data),
+                                                 apr_bucket_alloc_t *list);
+/**
+ * Make the bucket passed in a bucket refer to heap data
+ * @param b The bucket to make into a HEAP bucket
+ * @param buf The buffer to insert into the bucket
+ * @param nbyte The size of the buffer to insert.
+ * @param free_func Function to use to free the data; NULL indicates that the
+ *                  bucket should make a copy of the data
+ * @return The new bucket, or NULL if allocation failed
+ */
+APU_DECLARE(apr_bucket * ) apr_bucket_heap_make(apr_bucket *b, const char *buf,
+                                               apr_size_t nbyte,
+                                               void ( *free_func)(void *data));
+
+/**
+ * Create a bucket referring to memory allocated from a pool.
+ *
+ * @param buf The buffer to insert into the bucket
+ * @param length The number of bytes referred to by this bucket
+ * @param pool The pool the memory was allocated from
+ * @param list The freelist from which this bucket should be allocated
+ * @return The new bucket, or NULL if allocation failed
+ */
+APU_DECLARE(apr_bucket * ) apr_bucket_pool_create(const char *buf,
+                                                 apr_size_t length,
+                                                 apr_pool_t *pool,
+                                                 apr_bucket_alloc_t *list);
+
+/**
+ * Make the bucket passed in a bucket refer to pool data
+ * @param b The bucket to make into a pool bucket
+ * @param buf The buffer to insert into the bucket
+ * @param length The number of bytes referred to by this bucket
+ * @param pool The pool the memory was allocated from
+ * @return The new bucket, or NULL if allocation failed
+ */
+APU_DECLARE(apr_bucket * ) apr_bucket_pool_make(apr_bucket *b, const char *buf,
+                                               apr_size_t length, 
+                                               apr_pool_t *pool);
+
+#if APR_HAS_MMAP
+/**
+ * Create a bucket referring to mmap()ed memory.
+ * @param mm The mmap to insert into the bucket
+ * @param start The offset of the first byte in the mmap
+ *              that this bucket refers to
+ * @param length The number of bytes referred to by this bucket
+ * @param list The freelist from which this bucket should be allocated
+ * @return The new bucket, or NULL if allocation failed
+ */
+APU_DECLARE(apr_bucket * ) apr_bucket_mmap_create(apr_mmap_t *mm,
+                                                 apr_off_t start,
+                                                 apr_size_t length,
+                                                 apr_bucket_alloc_t *list);
+
+/**
+ * Make the bucket passed in a bucket refer to an MMAP'ed file
+ * @param b The bucket to make into a MMAP bucket
+ * @param mm The mmap to insert into the bucket
+ * @param start The offset of the first byte in the mmap
+ *              that this bucket refers to
+ * @param length The number of bytes referred to by this bucket
+ * @return The new bucket, or NULL if allocation failed
+ */
+APU_DECLARE(apr_bucket * ) apr_bucket_mmap_make(apr_bucket *b, apr_mmap_t *mm,
+                                               apr_off_t start, 
+                                               apr_size_t length);
+#endif
+
+/**
+ * Create a bucket referring to a socket.
+ * @param thissock The socket to put in the bucket
+ * @param list The freelist from which this bucket should be allocated
+ * @return The new bucket, or NULL if allocation failed
+ */
+APU_DECLARE(apr_bucket * ) apr_bucket_socket_create(apr_socket_t *thissock,
+                                                   apr_bucket_alloc_t *list);
+/**
+ * Make the bucket passed in a bucket refer to a socket
+ * @param b The bucket to make into a SOCKET bucket
+ * @param thissock The socket to put in the bucket
+ * @return The new bucket, or NULL if allocation failed
+ */
+APU_DECLARE(apr_bucket * ) apr_bucket_socket_make(apr_bucket *b,
+                                                 apr_socket_t *thissock);
+
+/**
+ * Create a bucket referring to a pipe.
+ * @param thispipe The pipe to put in the bucket
+ * @param list The freelist from which this bucket should be allocated
+ * @return The new bucket, or NULL if allocation failed
+ */
+APU_DECLARE(apr_bucket * ) apr_bucket_pipe_create(apr_file_t *thispipe,
+                                                 apr_bucket_alloc_t *list);
+
+/**
+ * Make the bucket passed in a bucket refer to a pipe
+ * @param b The bucket to make into a PIPE bucket
+ * @param thispipe The pipe to put in the bucket
+ * @return The new bucket, or NULL if allocation failed
+ */
+APU_DECLARE(apr_bucket * ) apr_bucket_pipe_make(apr_bucket *b,
+                                               apr_file_t *thispipe);
+
+/**
+ * Create a bucket referring to a file.
+ * @param fd The file to put in the bucket
+ * @param offset The offset where the data of interest begins in the file
+ * @param len The amount of data in the file we are interested in
+ * @param p The pool into which any needed structures should be created
+ *          while reading from this file bucket
+ * @param list The freelist from which this bucket should be allocated
+ * @return The new bucket, or NULL if allocation failed
+ * @remark If the file is truncated such that the segment of the file
+ * referenced by the bucket no longer exists, an attempt to read
+ * from the bucket will fail with APR_EOF. 
+ * @remark apr_brigade_insert_file() should generally be used to
+ * insert files into brigades, since that function can correctly
+ * handle large file issues.
+ */
+APU_DECLARE(apr_bucket * ) apr_bucket_file_create(apr_file_t *fd,
+                                                 apr_off_t offset,
+                                                 apr_size_t len, 
+                                                 apr_pool_t *p,
+                                                 apr_bucket_alloc_t *list);
+
+/**
+ * Make the bucket passed in a bucket refer to a file
+ * @param b The bucket to make into a FILE bucket
+ * @param fd The file to put in the bucket
+ * @param offset The offset where the data of interest begins in the file
+ * @param len The amount of data in the file we are interested in
+ * @param p The pool into which any needed structures should be created
+ *          while reading from this file bucket
+ * @return The new bucket, or NULL if allocation failed
+ */
+APU_DECLARE(apr_bucket * ) apr_bucket_file_make(apr_bucket *b, apr_file_t *fd,
+                                               apr_off_t offset,
+                                               apr_size_t len, apr_pool_t *p);
+
+/**
+ * Enable or disable memory-mapping for a FILE bucket (default is enabled)
+ * @param b The bucket
+ * @param enabled Whether memory-mapping should be enabled
+ * @return APR_SUCCESS normally, or an error code if the operation fails
+ */
+APU_DECLARE(apr_status_t) apr_bucket_file_enable_mmap(apr_bucket *b,
+                                                      int enabled);
+
+/** @} */
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !APR_BUCKETS_H */
+*)

+ 191 - 0
packages/httpd24/src/aprutil/apr_uri.inc

@@ -0,0 +1,191 @@
+{* 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_uri.h: External Interface of apr_uri.c
+ *}
+
+{**
+ * @file apr_uri.h
+ * @brief APR-UTIL URI Routines
+ *}
+
+//#ifndef APR_URI_H
+//#define APR_URI_H
+
+//#include "apu.h"
+
+//#include "apr_network_io.h"
+
+(**
+ * @defgroup APR_Util_URI URI
+ * @ingroup APR_Util
+ * @{
+ *)
+const
+  APR_URI_FTP_DEFAULT_PORT       =   21; //**< default FTP port */
+  APR_URI_SSH_DEFAULT_PORT       =   22; //**< default SSH port */
+  APR_URI_TELNET_DEFAULT_PORT    =   23; //**< default telnet port */
+  APR_URI_GOPHER_DEFAULT_PORT    =   70; //**< default Gopher port */
+  APR_URI_HTTP_DEFAULT_PORT      =   80; //**< default HTTP port */
+  APR_URI_POP_DEFAULT_PORT       =  110; //**< default POP port */
+  APR_URI_NNTP_DEFAULT_PORT      =  119; //**< default NNTP port */
+  APR_URI_IMAP_DEFAULT_PORT      =  143; //**< default IMAP port */
+  APR_URI_PROSPERO_DEFAULT_PORT  =  191; //**< default Prospero port */
+  APR_URI_WAIS_DEFAULT_PORT      =  210; //**< default WAIS port */
+  APR_URI_LDAP_DEFAULT_PORT      =  389; //**< default LDAP port */
+  APR_URI_HTTPS_DEFAULT_PORT     =  443; //**< default HTTPS port */
+  APR_URI_RTSP_DEFAULT_PORT      =  554; //**< default RTSP port */
+  APR_URI_SNEWS_DEFAULT_PORT     =  563; //**< default SNEWS port */
+  APR_URI_ACAP_DEFAULT_PORT      =  674; //**< default ACAP port */
+  APR_URI_NFS_DEFAULT_PORT       = 2049; //**< default NFS port */
+  APR_URI_TIP_DEFAULT_PORT       = 3372; //**< default TIP port */
+  APR_URI_SIP_DEFAULT_PORT       = 5060; //**< default SIP port */
+
+//** Flags passed to unparse_uri_components(): */
+//** suppress "scheme://user\@site:port" */
+  APR_URI_UNP_OMITSITEPART       = (1 shl 0);
+//** Just omit user */
+  APR_URI_UNP_OMITUSER           = (1 shl 1);
+//** Just omit password */
+  APR_URI_UNP_OMITPASSWORD       = (1 shl 2);
+//** omit "user:password\@" part */
+  APR_URI_UNP_OMITUSERINFO       = (APR_URI_UNP_OMITUSER or APR_URI_UNP_OMITPASSWORD);
+//** Show plain text password (default: show XXXXXXXX) */
+  APR_URI_UNP_REVEALPASSWORD     = (1 shl 3);
+//** Show "scheme://user\@site:port" only */
+  APR_URI_UNP_OMITPATHINFO       = (1 shl 4);
+//** Omit the "?queryarg" from the path */
+  APR_URI_UNP_OMITQUERY          = (1 shl 5);
+
+//** @see apr_uri_t */
+//typedef struct apr_uri_t apr_uri_t;
+type
+  Papr_uri_t = ^apr_uri_t;
+
+{**
+ * A structure to encompass all of the fields in a uri
+ *}
+  apr_uri_t = record
+   { scheme ("http"/"ftp"/...) }
+   scheme: PChar;
+   { combined [user[:password]\@]host[:port] }
+   hostinfo: PChar;
+   { user name, as in http://user:passwd\@host:port/ }
+   user: PChar;
+   { password, as in http://user:passwd\@host:port/ }
+   password: PChar;
+   { hostname from URI (or from Host: header) }
+   hostname: PChar;
+   { port string (integer representation is in "port") }
+   port_str: PChar;
+   { the request path (or "/" if only scheme://host was given) }
+   path: PChar;
+   { Everything after a '?' in the path, if present }
+   query: PChar;
+   { Trailing "#fragment" string, if present }
+   fragment: PChar;
+
+   { structure returned from gethostbyname() }
+   hostent: Pointer;
+
+   { The port number, numeric, valid only if port_str != NULL }
+   port: apr_port_t;
+
+   BitFlags : Cardinal; // Takes care of is_initialized, dns_looked_up and dns_resolved
+   { has the structure been initialized }
+//    unsigned is_initialized:1;
+
+   { has the DNS been looked up yet }
+//    unsigned dns_looked_up:1;
+   { has the dns been resolved yet }
+//    unsigned dns_resolved:1;
+  end;
+  {end apr_uri.h}
+
+//* apr_uri.c */
+{**
+ * Return the default port for a given scheme.  The schemes recognized are
+ * http, ftp, https, gopher, wais, nntp, snews, and prospero
+ * @param scheme_str The string that contains the current scheme
+ * @return The default port for this scheme
+ *}
+//APU_DECLARE(apr_port_t) apr_uri_port_of_scheme(const char *scheme_str);
+function apr_uri_port_of_scheme(const scheme_str: PChar): apr_port_t;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibAPRUtil name LibNamePrefix + 'apr_uri_port_of_scheme' + LibSuff4;
+
+{**
+ * Unparse a apr_uri_t structure to an URI string.  Optionally 
+ * suppress the password for security reasons.
+ * @param p The pool to allocate out of
+ * @param uptr All of the parts of the uri
+ * @param flags How to unparse the uri.  One of:
+ * <PRE>
+ *    APR_URI_UNP_OMITSITEPART        Suppress "scheme://user\@site:port" 
+ *    APR_URI_UNP_OMITUSER            Just omit user 
+ *    APR_URI_UNP_OMITPASSWORD        Just omit password 
+ *    APR_URI_UNP_OMITUSERINFO        Omit "user:password\@" part
+ *    APR_URI_UNP_REVEALPASSWORD      Show plain text password (default: show XXXXXXXX)
+ *    APR_URI_UNP_OMITPATHINFO        Show "scheme://user\@site:port" only 
+ *    APR_URI_UNP_OMITQUERY           Omit "?queryarg" or "#fragment" 
+ * </PRE>
+ * @return The uri as a string
+ *}
+//APU_DECLARE(char *) apr_uri_unparse(apr_pool_t *p,
+//                                    const apr_uri_t *uptr,
+//                                    unsigned flags);
+function apr_uri_unparse(p: Papr_pool_t;
+                         const uptr: Papr_uri_t;
+                         flags: cuint): PChar;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibAPRUtil name LibNamePrefix + 'apr_uri_unparse' + LibSuff12;
+
+{**
+ * Parse a given URI, fill in all supplied fields of a apr_uri_t
+ * structure. This eliminates the necessity of extracting host, port,
+ * path, query info repeatedly in the modules.
+ * @param p The pool to allocate out of
+ * @param uri The uri to parse
+ * @param uptr The apr_uri_t to fill out
+ * @return APR_SUCCESS for success or error code
+ *}
+//APU_DECLARE(apr_status_t) apr_uri_parse(apr_pool_t *p, const char *uri,
+//                                        apr_uri_t *uptr);
+function apr_uri_parse(p: Papr_pool_t; const uri: PChar;
+                       uptr: Papr_uri_t): apr_status_t;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibAPRUtil name LibNamePrefix + 'apr_uri_parse' + LibSuff12;
+
+{**
+ * Special case for CONNECT parsing: it comes with the hostinfo part only
+ * @param p The pool to allocate out of
+ * @param hostinfo The hostinfo string to parse
+ * @param uptr The apr_uri_t to fill out
+ * @return APR_SUCCESS for success or error code
+ *}
+//APU_DECLARE(apr_status_t) apr_uri_parse_hostinfo(apr_pool_t *p,
+//                                                 const char *hostinfo,
+//                                                 apr_uri_t *uptr);
+function apr_uri_parse_hostinfo(p: Papr_pool_t;
+                                const hostinfo: PChar;
+                                uptr: Papr_uri_t): apr_status_t;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibAPRUtil name LibNamePrefix + 'apr_uri_parse_hostinfo' + LibSuff12;
+
+(** @} *)
+
+//#endif /* APR_URI_H */

+ 1766 - 0
packages/httpd24/src/http_config.inc

@@ -0,0 +1,1766 @@
+{* 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.
+ *}
+
+(**
+ * @file http_config.h
+ * @brief Apache Configuration
+ *
+ * @defgroup APACHE_CORE_CONFIG Configuration
+ * @ingroup  APACHE_CORE
+ * @{
+ *)
+
+{$ifndef APACHE_HTTP_CONFIG_H}
+ {$define APACHE_HTTP_CONFIG_H}
+
+//#include "util_cfgtree.h"
+//#include "ap_config.h"
+//#include "apr_tables.h"
+
+{*
+ * The central data structures around here...
+ *}
+
+{* Command dispatch structures... *}
+
+{fpc -> moved const sections up here}
+(**
+ * @defgroup ConfigDirectives Allowed locations for configuration directives.
+ *
+ * The allowed locations for a configuration directive are the union of
+ * those indicated by each set bit in the req_override mask.
+ *
+ * @{
+ *)
+const
+  OR_NONE          = 0;    {**< *.conf is not available anywhere in this override *}
+  OR_LIMIT         = 1;    {**< *.conf inside &lt;Directory&gt; or &lt;Location&gt;
+                            and .htaccess when AllowOverride Limit *}
+  OR_OPTIONS       = 2;    {**< *.conf anywhere
+                            and .htaccess when AllowOverride Options *}
+  OR_FILEINFO      = 4;    {**< *.conf anywhere
+                            and .htaccess when AllowOverride FileInfo *}
+  OR_AUTHCFG       = 8;    {**< *.conf inside &lt;Directory&gt; or &lt;Location&gt;
+                            and .htaccess when AllowOverride AuthConfig *}
+  OR_INDEXES       = 16;   {**< *.conf anywhere
+                            and .htaccess when AllowOverride Indexes *}
+  OR_UNSET         = 32;   {**< bit to indicate that AllowOverride has not been set *}
+  ACCESS_CONF      = 64;   {**< *.conf inside &lt;Directory&gt; or &lt;Location&gt; *}
+  RSRC_CONF        = 128;  {**< *.conf outside &lt;Directory&gt; or &lt;Location&gt; *}
+  EXEC_ON_READ     = 256;  {**< force directive to execute a command
+                            which would modify the configuration (like including another
+                            file, or IFModule *}
+{* Flags to determine whether syntax errors in .htaccess should be
+ * treated as nonfatal (log and ignore errors)
+ *}
+  NONFATAL_OVERRIDE = 512; {* Violation of AllowOverride rule *}
+  NONFATAL_UNKNOWN  = 1024;{* Unrecognised directive *}
+  NONFATAL_ALL      = (NONFATAL_OVERRIDE or NONFATAL_UNKNOWN);
+
+{** this directive can be placed anywhere *}
+  OR_ALL            = (OR_LIMIT or OR_OPTIONS or OR_FILEINFO or OR_AUTHCFG or OR_INDEXES);
+
+(** @} *)
+
+{**
+ * This can be returned by a function if they don't wish to handle
+ * a command. Make it something not likely someone will actually use
+ * as an error code.
+ *}
+  DECLINE_CMD = '\a\b';
+
+{**
+ * How the directives arguments should be parsed.
+ * @remark Note that for all of these except RAW_ARGS, the config routine is
+ *      passed a freshly allocated string which can be modified or stored
+ *      or whatever...
+ *}
+type
+  cmd_how = (
+    RAW_ARGS,           {**< cmd_func parses command line itself *}
+    TAKE1,              {**< one argument only *}
+    TAKE2,              {**< two arguments only *}
+    ITERATE,            {**< one argument, occuring multiple times
+                         * (e.g., IndexIgnore)
+                         *}
+    ITERATE2,           {**< two arguments, 2nd occurs multiple times
+                         * (e.g., AddIcon)
+                         *}
+    FLAG,               {**< One of 'On' or 'Off' *}
+    NO_ARGS,            {**< No args at all, e.g. &lt;/Directory&gt; *}
+    TAKE12,             {**< one or two arguments *}
+    TAKE3,              {**< three arguments only *}
+    TAKE23,             {**< two or three arguments *}
+    TAKE123,            {**< one, two or three arguments *}
+    TAKE13,             {**< one or three arguments *}
+    TAKE_ARGV           {**< an argc and argv are passed *}
+);
+
+{**
+ * This structure is passed to a command which is being invoked,
+ * to carry a large variety of miscellaneous data which is all of
+ * use to *somebody*...
+ *}
+// typedef struct cmd_parms_struct cmd_parms;
+  Pcmd_parms = ^cmd_parms_struct;
+
+//#if defined(AP_HAVE_DESIGNATED_INITIALIZER) || defined(DOXYGEN)
+
+{**
+ * All the types of functions that can be used in directives
+ * @internal
+ *}
+  cmd_func = record
+     case longint of
+       {** function to call for a no-args *}
+       0 : ( no_args : function (parms:Pcmd_parms; mconfig:pointer):Pchar;cdecl; );
+
+       {** function to call for a raw-args *}
+       1 : ( raw_args : function (parms:Pcmd_parms; mconfig:pointer; args:Pchar):Pchar;cdecl; );
+
+       {** function to call for a argv/argc *}
+       2 : ( take_argv : function (parms:Pcmd_parms; mconfig:pointer; argc:longint; argv:PPchar):Pchar;cdecl; );
+
+       {** function to call for a take1 *}
+       3 : ( take1 : function (parms:Pcmd_parms; mconfig:pointer; w:Pchar):Pchar;cdecl; );
+
+       {** function to call for a take2 *}
+       4 : ( take2 : function (parms:Pcmd_parms; mconfig:pointer; w:Pchar; w2:Pchar):Pchar;cdecl; );
+
+       {** function to call for a take3 *}
+       5 : ( take3 : function (parms:Pcmd_parms; mconfig:pointer; w:Pchar; w2:Pchar; w3:Pchar):Pchar;cdecl; );
+
+       {** function to call for a flag *}
+       6 : ( flag : function (parms:Pcmd_parms; mconfig:pointer; on_:longint):Pchar;cdecl; );
+     end;
+  Pcmd_func = ^cmd_func;
+(*
+/** This configuration directive does not take any arguments */
+# define AP_NO_ARGS     func.no_args
+/** This configuration directive will handle its own parsing of arguments*/
+# define AP_RAW_ARGS    func.raw_args
+/** This configuration directive will handle its own parsing of arguments*/
+# define AP_TAKE_ARGV   func.take_argv
+/** This configuration directive takes 1 argument*/
+# define AP_TAKE1       func.take1
+/** This configuration directive takes 2 arguments */
+# define AP_TAKE2       func.take2
+/** This configuration directive takes 3 arguments */
+# define AP_TAKE3       func.take3
+/** This configuration directive takes a flag (on/off) as a argument*/
+# define AP_FLAG        func.flag
+
+/** mechanism for declaring a directive with no arguments */
+# define AP_INIT_NO_ARGS(directive, func, mconfig, where, help) \
+    { directive, { .no_args=func }, mconfig, where, RAW_ARGS, help }
+/** mechanism for declaring a directive with raw argument parsing */
+# define AP_INIT_RAW_ARGS(directive, func, mconfig, where, help) \
+    { directive, { .raw_args=func }, mconfig, where, RAW_ARGS, help }
+/** mechanism for declaring a directive with raw argument parsing */
+# define AP_INIT_TAKE_ARGV(directive, func, mconfig, where, help) \
+    { directive, { .take_argv=func }, mconfig, where, TAKE_ARGV, help }
+/** mechanism for declaring a directive which takes 1 argument */
+# define AP_INIT_TAKE1(directive, func, mconfig, where, help) \
+    { directive, { .take1=func }, mconfig, where, TAKE1, help }
+/** mechanism for declaring a directive which takes multiple arguments */
+# define AP_INIT_ITERATE(directive, func, mconfig, where, help) \
+    { directive, { .take1=func }, mconfig, where, ITERATE, help }
+/** mechanism for declaring a directive which takes 2 arguments */
+# define AP_INIT_TAKE2(directive, func, mconfig, where, help) \
+    { directive, { .take2=func }, mconfig, where, TAKE2, help }
+/** mechanism for declaring a directive which takes 1 or 2 arguments */
+# define AP_INIT_TAKE12(directive, func, mconfig, where, help) \
+    { directive, { .take2=func }, mconfig, where, TAKE12, help }
+/** mechanism for declaring a directive which takes multiple 2 arguments */
+# define AP_INIT_ITERATE2(directive, func, mconfig, where, help) \
+    { directive, { .take2=func }, mconfig, where, ITERATE2, help }
+/** mechanism for declaring a directive which takes 1 or 3 arguments */
+# define AP_INIT_TAKE13(directive, func, mconfig, where, help) \
+    { directive, { .take3=func }, mconfig, where, TAKE13, help }
+/** mechanism for declaring a directive which takes 2 or 3 arguments */
+# define AP_INIT_TAKE23(directive, func, mconfig, where, help) \
+    { directive, { .take3=func }, mconfig, where, TAKE23, help }
+/** mechanism for declaring a directive which takes 1 to 3 arguments */
+# define AP_INIT_TAKE123(directive, func, mconfig, where, help) \
+    { directive, { .take3=func }, mconfig, where, TAKE123, help }
+/** mechanism for declaring a directive which takes 3 arguments */
+# define AP_INIT_TAKE3(directive, func, mconfig, where, help) \
+    { directive, { .take3=func }, mconfig, where, TAKE3, help }
+/** mechanism for declaring a directive which takes a flag (on/off) argument */
+# define AP_INIT_FLAG(directive, func, mconfig, where, help) \
+    { directive, { .flag=func }, mconfig, where, FLAG, help }
+
+#else /* AP_HAVE_DESIGNATED_INITIALIZER */
+
+typedef const char *( *cmd_func) ();
+
+# define AP_NO_ARGS  func
+# define AP_RAW_ARGS func
+# define AP_TAKE_ARGV func
+# define AP_TAKE1    func
+# define AP_TAKE2    func
+# define AP_TAKE3    func
+# define AP_FLAG     func
+
+# define AP_INIT_NO_ARGS(directive, func, mconfig, where, help) \
+    { directive, func, mconfig, where, RAW_ARGS, help }
+# define AP_INIT_RAW_ARGS(directive, func, mconfig, where, help) \
+    { directive, func, mconfig, where, RAW_ARGS, help }
+# define AP_INIT_TAKE_ARGV(directive, func, mconfig, where, help) \
+    { directive, func, mconfig, where, TAKE_ARGV, help }
+# define AP_INIT_TAKE1(directive, func, mconfig, where, help) \
+    { directive, func, mconfig, where, TAKE1, help }
+# define AP_INIT_ITERATE(directive, func, mconfig, where, help) \
+    { directive, func, mconfig, where, ITERATE, help }
+# define AP_INIT_TAKE2(directive, func, mconfig, where, help) \
+    { directive, func, mconfig, where, TAKE2, help }
+# define AP_INIT_TAKE12(directive, func, mconfig, where, help) \
+    { directive, func, mconfig, where, TAKE12, help }
+# define AP_INIT_ITERATE2(directive, func, mconfig, where, help) \
+    { directive, func, mconfig, where, ITERATE2, help }
+# define AP_INIT_TAKE13(directive, func, mconfig, where, help) \
+    { directive, func, mconfig, where, TAKE13, help }
+# define AP_INIT_TAKE23(directive, func, mconfig, where, help) \
+    { directive, func, mconfig, where, TAKE23, help }
+# define AP_INIT_TAKE123(directive, func, mconfig, where, help) \
+    { directive, func, mconfig, where, TAKE123, help }
+# define AP_INIT_TAKE3(directive, func, mconfig, where, help) \
+    { directive, func, mconfig, where, TAKE3, help }
+# define AP_INIT_FLAG(directive, func, mconfig, where, help) \
+    { directive, func, mconfig, where, FLAG, help }
+
+#endif /* AP_HAVE_DESIGNATED_INITIALIZER */
+*)
+{**
+ * The command record structure.  Each modules can define a table of these
+ * to define the directives it will implement.
+ *}
+  command_struct = record
+    {** Name of this command *}
+    name: PChar;
+    {** The function to be called when this directive is parsed *}
+    func: cmd_func;
+    {** Extra data, for functions which implement multiple commands... *}
+    cmd_data: Pointer;
+    {** What overrides need to be allowed to enable this command. *}
+    req_override: Integer;
+    {** What the command expects as arguments *}
+    args_how: cmd_how;
+
+    {** 'usage' message, in case of syntax errors *}
+    errmsg: PChar;
+  end;
+  command_rec = command_struct;
+  Pcommand_rec = ^command_rec;
+
+
+{** Common structure for reading of config files / passwd files etc. *}
+  Pap_configfile_t = ^ap_configfile_t;
+  PPap_configfile_t = ^Pap_configfile_t;
+  ap_configfile_t = record
+    {**< an apr_file_getc()-like function *}
+    getch : function (ch:Pchar; param:pointer):apr_status_t;cdecl;
+    {**< an apr_file_gets()-like function *}
+    getstr : function (buf:pointer; bufsiz:apr_size_t; param:pointer):apr_status_t;cdecl;
+    {**< a close handler function *}
+    close : function (param:pointer):apr_status_t;cdecl;
+    {**< the argument passed to getch/getstr/close *}
+    param : pointer;
+    {**< the filename / description *}
+    name : Pchar;
+    {**< current line number, starting at 1 *}
+    line_number : dword;
+  end;
+
+{**
+ * This structure is passed to a command which is being invoked,
+ * to carry a large variety of miscellaneous data which is all of
+ * use to *somebody*...
+ *}
+  cmd_parms_struct = record
+    {** Argument to command from cmd_table *}
+    info : pointer;
+    {** Which allow-override bits are set *}
+    override_ : longint;
+    {** Which allow-override-opts bits are set *}
+    override_opts : longint;
+    {** Table of directives allowed per AllowOverrideList *}
+    override_list : Papr_table_t;
+    {** Which methods are &lt;Limit&gt;ed *}
+    limited : apr_int64_t;
+    {** methods which are limited *}
+    limited_xmethods : Papr_array_header_t;
+    {** methods which are xlimited *}
+    xlimited : Pap_method_list_t;
+
+    {** Config file structure. *}
+    config_file : Pap_configfile_t;
+    {** the directive specifying this command *}
+    directive : Pap_directive_t;
+
+    {** Pool to allocate new storage in *}
+    pool : Papr_pool_t;
+    {** Pool for scratch memory; persists during configuration, but
+     *  wiped before the first request is served...  *}
+    temp_pool : Papr_pool_t;
+    {** Server_rec being configured for *}
+    server : Pserver_rec;
+    {** If configuring for a directory, pathname of that directory.
+     *  NOPE!  That's what it meant previous to the existence of &lt;Files&gt;,
+     * &lt;Location&gt; and regex matching.  Now the only usefulness that can be
+     * derived from this field is whether a command is being called in a
+     * server context (path == NULL) or being called in a dir context
+     * (path != NULL).  *}
+    path : Pchar;
+    {** configuration command *}
+    cmd : Pcommand_rec;
+
+    {** per_dir_config vector passed to handle_command *}
+    context : Pap_conf_vector_t;
+    {** directive with syntax error *}
+    err_directive : Pap_directive_t;
+  end;
+
+{**
+ * Module structures.  Just about everything is dispatched through
+ * these, directly or indirectly (through the command and handler
+ * tables).
+ *}
+ Pmodule_struct = ^module_struct;
+ module_struct = record
+    {** API version, *not* module version; check that module is
+     * compatible with this version of the server.
+     *}
+    version : longint;
+    {** API minor version. Provides API feature milestones. Not checked
+     *  during module init *}
+    minor_version : longint;
+    {** Index to this modules structures in config vectors.  *}
+    module_index : longint;
+
+    {** The name of the module's C file *}
+    name : Pchar;
+    {** The handle for the DSO.  Internal use only *}
+    dynamic_load_handle : pointer;
+
+    {** A pointer to the next module in the list
+     *  @var module_struct *next
+     *}
+    next : Pmodule_struct;
+
+    {** Magic Cookie to identify a module structure;  It's mainly
+     *  important for the DSO facility (see also mod_so).  *}
+    magic : dword;
+
+    {** Function to allow MPMs to re-write command line arguments.  This
+     *  hook is only available to MPMs.
+     *  @param The process that the server is running in.
+     *}
+    rewrite_args : procedure (process:Pprocess_rec);cdecl;
+
+    {** Function to allow all modules to create per directory configuration
+     *  structures.
+     *  @param p The pool to use for all allocations.
+     *  @param dir The directory currently being processed.
+     *  @return The per-directory structure created
+     *}
+    create_dir_config : function (p:Papr_pool_t; dir:Pchar):pointer;cdecl;
+
+    {** Function to allow all modules to merge the per directory configuration
+     *  structures for two directories.
+     *  @param p The pool to use for all allocations.
+     *  @param base_conf The directory structure created for the parent directory.
+     *  @param new_conf The directory structure currently being processed.
+     *  @return The new per-directory structure created
+     *}
+    merge_dir_config : function (p:Papr_pool_t; base_conf:pointer; new_conf:pointer):pointer;cdecl;
+
+    {** Function to allow all modules to create per server configuration
+     *  structures.
+     *  @param p The pool to use for all allocations.
+     *  @param s The server currently being processed.
+     *  @return The per-server structure created
+     *}
+    create_server_config : function (p:Papr_pool_t; s:Pserver_rec):pointer;cdecl;
+
+    {** Function to allow all modules to merge the per server configuration
+     *  structures for two servers.
+     *  @param p The pool to use for all allocations.
+     *  @param base_conf The directory structure created for the parent directory.
+     *  @param new_conf The directory structure currently being processed.
+     *  @return The new per-directory structure created
+     *}
+    merge_server_config : function (p:Papr_pool_t; base_conf:pointer; new_conf:pointer):pointer;cdecl;
+
+    {** A command_rec table that describes all of the directives this module
+     * defines. *}
+    cmds : Pcommand_rec;
+
+    {** A hook to allow modules to hook other points in the request processing.
+     *  In this function, modules should call the ap_hook_*() functions to
+     *  register an interest in a specific step in processing the current
+     *  request.
+     *  @param p the pool to use for all allocations
+     *}
+    register_hooks : procedure (p:Papr_pool_t);cdecl;
+  end;
+  module = module_struct;
+  Pmodule = ^module;
+  PPmodule = ^Pmodule;
+
+{**
+ * The APLOG_USE_MODULE macro is used choose which module a file belongs to.
+ * This is necessary to allow per-module loglevel configuration.
+ *
+ * APLOG_USE_MODULE indirectly sets APLOG_MODULE_INDEX and APLOG_MARK.
+ *
+ * If a module should be backward compatible with versions before 2.3.6,
+ * APLOG_USE_MODULE needs to be enclosed in a ifdef APLOG_USE_MODULE block.
+ *
+ * @param foo name of the module symbol of the current module, without the
+ *            trailing "_module" part
+ * @see APLOG_MARK
+ *}
+{#define APLOG_USE_MODULE(foo) \
+    extern module AP_MODULE_DECLARE_DATA foo##_module;                  \
+    static int * const aplog_module_index = &(foo##_module.module_index)
+
+/**
+ * AP_DECLARE_MODULE is a convenience macro that combines a call of
+ * APLOG_USE_MODULE with the definition of the module symbol.
+ *
+ * If a module should be backward compatible with versions before 2.3.6,
+ * APLOG_USE_MODULE should be used explicitly instead of AP_DECLARE_MODULE.
+ */
+#define AP_DECLARE_MODULE(foo) \
+    APLOG_USE_MODULE(foo);                         \
+    module AP_MODULE_DECLARE_DATA foo##_module
+}
+(**
+ * @defgroup ModuleInit Module structure initializers
+ *
+ * Initializer for the first few module slots, which are only
+ * really set up once we start running.  Note that the first two slots
+ * provide a version check; this should allow us to deal with changes to
+ * the API. The major number should reflect changes to the API handler table
+ * itself or removal of functionality. The minor number should reflect
+ * additions of functionality to the existing API. (the server can detect
+ * an old-format module, and either handle it back-compatibly, or at least
+ * signal an error). See src/include/ap_mmn.h for MMN version history.
+ * @{
+ *)
+
+{** The one used in Apache 1.3, which will deliberately cause an error *}
+//#define STANDARD_MODULE_STUFF   this_module_needs_to_be_ported_to_apache_2_0
+
+{** Use this in all standard modules *}
+(*#define STANDARD20_MODULE_STUFF MODULE_MAGIC_NUMBER_MAJOR, \
+                                MODULE_MAGIC_NUMBER_MINOR, \
+                                -1, \
+                                __FILE__, \
+                                NULL, \
+                                NULL, \
+                                MODULE_MAGIC_COOKIE, \
+                                NULL      /* rewrite args spot */*)
+procedure STANDARD20_MODULE_STUFF(var mod_: module);
+
+{** Use this only in MPMs *}
+(*#define MPM20_MODULE_STUFF      MODULE_MAGIC_NUMBER_MAJOR, \
+                                MODULE_MAGIC_NUMBER_MINOR, \
+                                -1, \
+                                __FILE__, \
+                                NULL, \
+                                NULL, \
+                                MODULE_MAGIC_COOKIE*)
+procedure MPM20_MODULE_STUFF(var mod_: module);
+
+(** @} *)
+
+{* CONFIGURATION VECTOR FUNCTIONS *}
+
+{** configuration vector structure *}
+//typedef struct ap_conf_vector_t ap_conf_vector_t;
+{ Moved to httpd.pas}
+//  ap_conf_vector_t = record end;
+//  Pap_conf_vector_t = ^ap_conf_vector_t;
+//  PPap_conf_vector_t = ^Pap_conf_vector_t;
+
+{**
+ * Generic accessors for other modules to get at their own module-specific
+ * data
+ * @param cv The vector in which the modules configuration is stored.
+ *        usually r->per_dir_config or s->module_config
+ * @param m The module to get the data for.
+ * @return The module-specific data
+ *}
+//AP_DECLARE(void *) ap_get_module_config(const ap_conf_vector_t *cv,
+//                                        const module *m);
+{not found in httpd binary libraries, ignored}
+
+{**
+ * Generic accessors for other modules to set at their own module-specific
+ * data
+ * @param cv The vector in which the modules configuration is stored.
+ *        usually r->per_dir_config or s->module_config
+ * @param m The module to set the data for.
+ * @param val The module-specific data to set
+ *}
+//AP_DECLARE(void) ap_set_module_config(ap_conf_vector_t *cv, const module *m,
+//                                      void *val);
+
+//{$ifndef AP_DEBUG}
+//
+//function ap_get_module_config(v: Pap_conf_vector_t; m: Pmodule): Pap_conf_vector_t;
+//
+//procedure ap_set_module_config(v: Pap_conf_vector_t; m: Pmodule; val: Pap_conf_vector_t);
+//
+//{$endif} {* AP_DEBUG *}
+
+{**
+ * Generic accessor for modules to get the module-specific loglevel
+ * @param s The server from which to get the loglevel.
+ * @param index The module_index of the module to get the loglevel for.
+ * @return The module-specific loglevel
+ *}
+//AP_DECLARE(int) ap_get_server_module_loglevel(const server_rec *s, int index);
+
+{**
+ * Generic accessor for modules the module-specific loglevel
+ * @param c The connection from which to get the loglevel.
+ * @param index The module_index of the module to get the loglevel for.
+ * @return The module-specific loglevel
+ *}
+//AP_DECLARE(int) ap_get_conn_module_loglevel(const conn_rec *c, int index);
+
+{**
+ * Generic accessor for modules the module-specific loglevel
+ * @param c The connection from which to get the loglevel.
+ * @param s The server from which to get the loglevel if c does not have a
+ *          specific loglevel configuration.
+ * @param index The module_index of the module to get the loglevel for.
+ * @return The module-specific loglevel
+ *}
+//AP_DECLARE(int) ap_get_conn_server_module_loglevel(const conn_rec *c,
+//                                                   const server_rec *s,
+//                                                   int index);
+
+{**
+ * Generic accessor for modules to get the module-specific loglevel
+ * @param r The request from which to get the loglevel.
+ * @param index The module_index of the module to get the loglevel for.
+ * @return The module-specific loglevel
+ *}
+//AP_DECLARE(int) ap_get_request_module_loglevel(const request_rec *r, int index);
+
+{**
+ * Accessor to set module-specific loglevel
+ * @param p A pool
+ * @param l The ap_logconf struct to modify.
+ * @param index The module_index of the module to set the loglevel for.
+ * @param level The new log level
+ *}
+procedure ap_set_module_loglevel(p: Papr_pool_t; l: Pap_logconf;
+                                        index, level: Integer);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_set_module_loglevel' + LibSuff16;
+{
+#if !defined(AP_DEBUG)
+
+#define ap_get_conn_logconf(c)                     \
+    ((c)->log             ? (c)->log             : \
+     &(c)->base_server->log)
+
+#define ap_get_conn_server_logconf(c,s)                             \
+    ( ( (c)->log != &(c)->base_server->log && (c)->log != NULL )  ? \
+      (c)->log                                                    : \
+      &(s)->log )
+
+#define ap_get_request_logconf(r)                  \
+    ((r)->log             ? (r)->log             : \
+     (r)->connection->log ? (r)->connection->log : \
+     &(r)->server->log)
+
+#define ap_get_module_loglevel(l,i)                                     \
+    (((i) < 0 || (l)->module_levels == NULL || (l)->module_levels[i] < 0) ?  \
+     (l)->level :                                                         \
+     (l)->module_levels[i])
+
+#define ap_get_server_module_loglevel(s,i)  \
+    (ap_get_module_loglevel(&(s)->log,i))
+
+#define ap_get_conn_module_loglevel(c,i)  \
+    (ap_get_module_loglevel(ap_get_conn_logconf(c),i))
+
+#define ap_get_conn_server_module_loglevel(c,s,i)  \
+    (ap_get_module_loglevel(ap_get_conn_server_logconf(c,s),i))
+
+#define ap_get_request_module_loglevel(r,i)  \
+    (ap_get_module_loglevel(ap_get_request_logconf(r),i))
+
+#endif /* AP_DEBUG */
+}
+{**
+ * Set all module-specific loglevels to val
+ * @param l The log config for which to set the loglevels.
+ * @param val the value to set all loglevels to
+ *}
+procedure ap_reset_module_loglevels(l: Pap_logconf; val: Integer);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_reset_module_loglevels' + LibSuff8;
+
+{**
+ * Generic command handling function for strings
+ * @param cmd The command parameters for this directive
+ * @param struct_ptr pointer into a given type
+ * @param arg The argument to the directive
+ * @return An error string or NULL on success
+ *}
+//AP_DECLARE_NONSTD(const char *) ap_set_string_slot(cmd_parms *cmd,
+//                                                   void *struct_ptr,
+//                                                   const char *arg);
+function ap_set_string_slot(cmd: Pcmd_parms;
+                            struct_ptr: Pointer;
+                            const arg: PChar): PChar; cdecl;
+  external LibHTTPD name 'ap_set_string_slot';
+
+{**
+ * Generic command handling function for integers
+ * @param cmd The command parameters for this directive
+ * @param struct_ptr pointer into a given type
+ * @param arg The argument to the directive
+ * @return An error string or NULL on success
+ *}
+//AP_DECLARE_NONSTD(const char *) ap_set_int_slot(cmd_parms *cmd,
+//                                                void *struct_ptr,
+//                                                const char *arg);
+function ap_set_int_slot(cmd: Pcmd_parms; struct_ptr: Pointer; const arg: PChar): PChar; cdecl;
+  external LibHTTPD name 'ap_set_int_slot';
+
+{**
+ * Parsing function for log level
+ * @param str The string to parse
+ * @param val The parsed log level
+ * @return An error string or NULL on success
+ *}
+function ap_parse_log_level(const str: PChar; val: Integer): PChar;
+{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+external LibHTTPD name LibNamePrefix + 'ap_parse_log_level' + LibSuff8;
+
+{**
+ * Return true if the specified method is limited by being listed in
+ * a &lt;Limit&gt; container, or by *not* being listed in a &lt;LimitExcept&gt;
+ * container.
+ *
+ * @param   method  Pointer to a string specifying the method to check.
+ * @param   cmd     Pointer to the cmd_parms structure passed to the
+ *                  directive handler.
+ * @return  0 if the method is not limited in the current scope
+ *}
+function ap_method_is_limited(cmd: Pcmd_parms; const method: PChar): Integer;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_method_is_limited' + LibSuff8;
+
+{**
+ * Generic command handling function for strings, always sets the value
+ * to a lowercase string
+ * @param cmd The command parameters for this directive
+ * @param struct_ptr pointer into a given type
+ * @param arg The argument to the directive
+ * @return An error string or NULL on success
+ *}
+//AP_DECLARE_NONSTD(const char *) ap_set_string_slot_lower(cmd_parms *cmd,
+//                                                         void *struct_ptr,
+//                                                         const char *arg);
+function ap_set_string_slot_lower(cmd: Pcmd_parms;
+                                  struct_ptr: Pointer;
+                                  const arg: PChar): PChar; cdecl;
+  external LibHTTPD name 'ap_set_string_slot_lower';
+
+{**
+ * Generic command handling function for flags stored in an int
+ * @param cmd The command parameters for this directive
+ * @param struct_ptr pointer into a given type
+ * @param arg The argument to the directive (either 1 or 0)
+ * @return An error string or NULL on success
+ *}
+//AP_DECLARE_NONSTD(const char *) ap_set_flag_slot(cmd_parms *cmd,
+//                                                 void *struct_ptr,
+//                                                 int arg);
+function ap_set_flag_slot(cmd: Pcmd_parms;
+                          struct_ptr: Pointer;
+                          const arg: PChar): PChar; cdecl;
+  external LibHTTPD name 'ap_set_flag_slot';
+
+{**
+ * Generic command handling function for flags stored in a char
+ * @param cmd The command parameters for this directive
+ * @param struct_ptr pointer into a given type
+ * @param arg The argument to the directive (either 1 or 0)
+ * @return An error string or NULL on success
+ *}
+//AP_DECLARE_NONSTD(const char *) ap_set_flag_slot_char(cmd_parms *cmd,
+//                                                      void *struct_ptr,
+//                                                      int arg);
+function ap_set_flag_slot_char(cmd: Pcmd_parms;
+                               struct_ptr: Pointer;
+                               arg: Integer): PChar; cdecl;
+  external LibHTTPD name 'ap_set_flag_slot_char';
+
+{**
+ * Generic command handling function for files
+ * @param cmd The command parameters for this directive
+ * @param struct_ptr pointer into a given type
+ * @param arg The argument to the directive
+ * @return An error string or NULL on success
+ *}
+//AP_DECLARE_NONSTD(const char *) ap_set_file_slot(cmd_parms *cmd,
+//                                                 void *struct_ptr,
+//                                                 const char *arg);
+function ap_set_file_slot(cmd: Pcmd_parms; struct_ptr: Pointer; const arg: PChar): PChar; cdecl;
+  external LibHTTPD name 'ap_set_file_slot';
+
+{**
+ * Generic command handling function to respond with cmd->help as an error
+ * @param cmd The command parameters for this directive
+ * @param struct_ptr pointer into a given type
+ * @param arg The argument to the directive
+ * @return The cmd->help value as the error string
+ * @note This allows simple declarations such as:
+ * @code
+ *     AP_INIT_RAW_ARGS("Foo", ap_set_deprecated, NULL, OR_ALL,
+ *         "The Foo directive is no longer supported, use Bar"),
+ * @endcode
+ *}
+//AP_DECLARE_NONSTD(const char *) ap_set_deprecated(cmd_parms *cmd,
+//                                                  void *struct_ptr,
+//                                                  const char *arg);
+ function ap_set_deprecated(cmd: Pcmd_parms;
+                            struct_ptr: Pointer;
+                            const arg: PChar): PChar; cdecl;
+   external LibHTTPD name 'ap_set_deprecated';
+
+{**
+ * For modules which need to read config files, open logs, etc. this returns
+ * the canonical form of fname made absolute to ap_server_root.
+ * @param p pool to allocate data from
+ * @param fname The file name
+ *}
+function ap_server_root_relative(p: Papr_pool_t; const fname: PChar): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_server_root_relative' + LibSuff8;
+
+{**
+ * Compute the name of a run-time file (e.g., shared memory "file") relative
+ * to the appropriate run-time directory.  Absolute paths are returned as-is.
+ * The run-time directory is configured via the DefaultRuntimeDir directive or
+ * at build time.
+ *}
+function ap_runtime_dir_relative(p: Papr_pool_t; const fname: PChar): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_runtime_dir_relative' + LibSuff8;
+
+{* Finally, the hook for dynamically loading modules in... *}
+
+{**
+ * Add a module to the server
+ * @param m The module structure of the module to add
+ * @param p The pool of the same lifetime as the module
+ * @param s The module's symbol name (used for logging)
+ *}
+function ap_add_module(m: Pmodule; p: Papr_pool_t; s: PChar): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_add_module' + LibSuff12;
+
+{**
+ * Remove a module from the server.  There are some caveats:
+ * when the module is removed, its slot is lost so all the current
+ * per-dir and per-server configurations are invalid. So we should
+ * only ever call this function when you are invalidating almost
+ * all our current data. I.e. when doing a restart.
+ * @param m the module structure of the module to remove
+ *}
+procedure ap_remove_module(m: Pmodule);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_remove_module' + LibSuff4;
+
+{**
+ * Add a module to the chained modules list and the list of loaded modules
+ * @param mod The module structure of the module to add
+ * @param p The pool with the same lifetime as the module
+ * @param s The module's symbol name (used for logging)
+ *}
+function ap_add_loaded_module(mod_: Pmodule; p: Papr_pool_t; s: PChar): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_add_loaded_module' + LibSuff12;
+
+{**
+ * Remove a module fromthe chained modules list and the list of loaded modules
+ * @param mod the module structure of the module to remove
+ *}
+procedure ap_remove_loaded_module(m: Pmodule);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_remove_loaded_module' + LibSuff4;
+
+{**
+ * Find the name of the specified module
+ * @param m The module to get the name for
+ * @return the name of the module
+ *}
+ function ap_find_module_name(m: Pmodule): PChar;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name LibNamePrefix + 'ap_find_module_name' + LibSuff4;
+
+{**
+ * Find the short name of the module identified by the specified module index
+ * @param module_index The module index to get the name for
+ * @return the name of the module, NULL if not found
+ *}
+function ap_find_module_short_name(module_index: Integer): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_find_module_short_name' + LibSuff4;
+
+{**
+ * Find a module based on the name of the module
+ * @param name the name of the module
+ * @return the module structure if found, NULL otherwise
+ *}
+function ap_find_linked_module(const name: PChar): Pmodule;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_find_linked_module' + LibSuff4;
+
+{**
+ * Open a ap_configfile_t as apr_file_t
+ * @param ret_cfg open ap_configfile_t struct pointer
+ * @param p The pool to allocate the structure from
+ * @param name the name of the file to open
+ *}
+function ap_pcfg_openfile(ret_cfg: PPap_configfile_t;
+ p: Papr_pool_t; const name: PChar): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_pcfg_openfile' + LibSuff12;
+
+{**
+ * Allocate a ap_configfile_t handle with user defined functions and params
+ * @param p The pool to allocate from
+ * @param descr The name of the file
+ * @param param The argument passed to getch/getstr/close
+ * @param getc_func The getch function
+ * @param gets_func The getstr function
+ * @param close_func The close function
+ *}
+//AP_DECLARE(ap_configfile_t *) ap_pcfg_open_custom(apr_pool_t *p,
+//    const char *descr,
+//    void *param,
+//    apr_status_t (*getc_func) (char *ch, void *param),
+//    apr_status_t (*gets_func) (void *buf, apr_size_t bufsiz, void *param),
+//    apr_status_t (*close_func) (void *param));
+type
+ getc_func_t = function (ch: PChar; param: Pointer): apr_status_t;
+ gets_func_t = function (buf: Pointer; bufsiz: apr_size_t; param: Pointer): apr_status_t;
+ close_func_t = function (param: Pointer): apr_status_t;
+
+ function ap_pcfg_open_custom(p: Papr_pool_t;
+                              const descr: PChar;
+                              param: Pointer;
+                              getc_func: getc_func_t;
+                              gets_func: gets_func_t;
+                              close_func: close_func_t): Pap_configfile_t;
+     {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+     external LibHTTPD name LibNamePrefix + 'ap_pcfg_open_custom' + LibSuff24;
+
+{**
+ * Read one line from open ap_configfile_t, strip leading and trailing
+ * whitespace, increase line number
+ * @param buf place to store the line read
+ * @param bufsize size of the buffer
+ * @param cfp File to read from
+ * @return error status, APR_ENOSPC if bufsize is too small for the line
+ *}
+function ap_cfg_getline(buf: PChar; bufsize: apr_size_t; cfp: Pap_configfile_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_cfg_getline' + LibSuff12;
+
+{**
+ * Read one char from open configfile_t, increase line number upon LF
+ * @param ch place to store the char read
+ * @param cfp The file to read from
+ * @return error status
+ *}
+function ap_cfg_getc(ch: PChar; cfp: Pap_configfile_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_cfg_getc' + LibSuff8;
+
+{**
+ * Detach from open ap_configfile_t, calling the close handler
+ * @param cfp The file to close
+ * @return 1 on sucess, 0 on failure
+ *}
+function ap_cfg_closefile(cfp: Pap_configfile_t): Integer;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_cfg_closefile' + LibSuff4;
+
+{**
+ * Convert a return value from ap_cfg_getline or ap_cfg_getc to a user friendly
+ * string.
+ * @param p The pool to allocate the string from
+ * @param cfp The config file
+ * @param rc The return value to convert
+ * @return The error string, NULL if rc == APR_SUCCESS
+ *}
+function ap_pcfg_strerror(p: Papr_pool_t; cfp: Pap_configfile_t;
+                                          rc: apr_status_t): PChar;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name LibNamePrefix + 'ap_pcfg_strerror' + LibSuff12;
+
+{**
+ * Read all data between the current &lt;foo&gt; and the matching &lt;/foo&gt;.  All
+ * of this data is forgotten immediately.
+ * @param cmd The cmd_parms to pass to the directives inside the container
+ * @param directive The directive name to read until
+ * @return Error string on failure, NULL on success
+ * @note If cmd->pool == cmd->temp_pool, ap_soak_end_container() will assume
+ *       .htaccess context and use a lower maximum line length.
+ *}
+function ap_soak_end_container(cmd: Pcmd_parms; directive: PChar): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_soak_end_container' + LibSuff8;
+
+{**
+ * Read all data between the current &lt;foo&gt; and the matching &lt;/foo&gt; and build
+ * a config tree from it
+ * @param p pool to allocate from
+ * @param temp_pool Temporary pool to allocate from
+ * @param parms The cmd_parms to pass to all directives read
+ * @param current The current node in the tree
+ * @param curr_parent The current parent node
+ * @param orig_directive The directive to read until hit.
+ * @return Error string on failure, NULL on success
+ * @note If p == temp_pool, ap_build_cont_config() will assume .htaccess
+ *       context and use a lower maximum line length.
+*}
+function ap_build_cont_config(p,
+                              temp_pool: Papr_pool_t;
+                              parms: Pcmd_parms;
+                              current,
+                              curr_parent: PPap_directive_t;
+                              orig_directive: PChar): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_build_cont_config' + LibSuff24;
+
+{**
+ * Build a config tree from a config file
+ * @param parms The cmd_parms to pass to all of the directives in the file
+ * @param conf_pool The pconf pool
+ * @param temp_pool The temporary pool
+ * @param conftree Place to store the root node of the config tree
+ * @return Error string on erro, NULL otherwise
+ * @note If conf_pool == temp_pool, ap_build_config() will assume .htaccess
+ *       context and use a lower maximum line length.
+ *}
+function ap_build_config(parms: Pcmd_parms;
+                         conf_pool,
+                         temp_pool: Papr_pool_t;
+                         conftree: PPap_directive_t): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_build_config' + LibSuff16;
+
+{**
+ * Walk a config tree and setup the server's internal structures
+ * @param conftree The config tree to walk
+ * @param parms The cmd_parms to pass to all functions
+ * @param section_vector The per-section config vector.
+ * @return Error string on error, NULL otherwise
+ *}
+function ap_walk_config(conftree: Pap_directive_t;
+                        parms: Pcmd_parms;
+                        section_vector: Pap_conf_vector_t): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_walk_config' + LibSuff12;
+
+(**
+ * @defgroup ap_check_cmd_context Check command context
+ * @{
+ *)
+{**
+ * Check the context a command is used in.
+ * @param cmd The command to check
+ * @param forbidden Where the command is forbidden.
+ * @return Error string on error, NULL on success
+ *}
+function ap_check_cmd_context(cmd: Pcmd_parms;
+                              forbidden: dword): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_check_cmd_context' + LibSuff8;
+
+const
+
+  NOT_IN_VIRTUALHOST     = $01;{**< Forbidden in &lt;VirtualHost&gt; *}
+  NOT_IN_LIMIT           = $02;{**< Forbidden in &lt;Limit&gt; *}
+  NOT_IN_DIRECTORY       = $04;{**< Forbidden in &lt;Directory&gt; *}
+  NOT_IN_LOCATION        = $08;{**< Forbidden in &lt;Location&gt; *}
+  NOT_IN_FILES           = $10;{**< Forbidden in &lt;Files&gt; *}
+  NOT_IN_HTACCESS        = $20;{**< Forbidden in .htaccess files *}
+{** Forbidden in &lt;Directory&gt;/&lt;Location&gt;/&lt;Files&gt;*}
+  NOT_IN_DIR_LOC_FILE    = (NOT_IN_DIRECTORY or NOT_IN_LOCATION or NOT_IN_FILES);
+{** Forbidden in &lt;VirtualHost&gt;/&lt;Limit&gt;/&lt;Directory&gt;/&lt;Location&gt;/&lt;Files&gt; *}
+  GLOBAL_ONLY            = (NOT_IN_VIRTUALHOST or NOT_IN_LIMIT or NOT_IN_DIR_LOC_FILE);
+
+(** @} *)
+
+{**
+ * @brief This structure is used to assign symbol names to module pointers
+ *}
+type
+  ap_module_symbol_t = record
+    name: PChar;
+    modp: Pmodule;
+  end;
+
+{**
+ * The topmost module in the list
+ * @var module *ap_top_module
+ *}
+//AP_DECLARE_DATA extern module *ap_top_module;
+
+{**
+ * Array of all statically linked modules
+ * @var module *ap_prelinked_modules[]
+ *}
+//AP_DECLARE_DATA extern module *ap_prelinked_modules[];
+{**
+ * Array of all statically linked modulenames (symbols)
+ * @var ap_module_symbol_t ap_prelinked_module_symbols[]
+ *}
+//AP_DECLARE_DATA extern ap_module_symbol_t ap_prelinked_module_symbols[];
+{**
+ * Array of all preloaded modules
+ * @var module *ap_preloaded_modules[]
+ *}
+//AP_DECLARE_DATA extern module *ap_preloaded_modules[];
+{**
+ * Array of all loaded modules
+ * @var module **ap_loaded_modules
+ *}
+//AP_DECLARE_DATA extern module **ap_loaded_modules;
+
+{* For mod_so.c... *}
+{** Run a single module's two create_config hooks
+ *  @param p the pool to allocate from
+ *  @param s The server to configure for.
+ *  @param m The module to configure
+ *}
+procedure ap_single_module_configure(p: Papr_pool_t; s: Pserver_rec;
+                                     m: Pmodule);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_single_module_configure' + LibSuff12;
+
+{* For http_main.c... *}
+{**
+ * Add all of the prelinked modules into the loaded module list
+ * @param process The process that is currently running the server
+ *}
+function ap_setup_prelinked_modules(process: Pprocess_rec): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_setup_prelinked_modules' + LibSuff4;
+
+{**
+ * Show the preloaded configuration directives, the help string explaining
+ * the directive arguments, in what module they are handled, and in
+ * what parts of the configuration they are allowed.  Used for httpd -h.
+ *}
+procedure ap_show_directives;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_show_directives' + LibSuff0;
+
+{**
+ * Show the preloaded module names.  Used for httpd -l.
+ *}
+procedure ap_show_modules;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_show_modules' + LibSuff0;
+
+{**
+ * Show the MPM name.  Used in reporting modules such as mod_info to
+ * provide extra information to the user
+ *}
+function ap_show_mpm: PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_show_mpm' + LibSuff0;
+
+{**
+ * Read all config files and setup the server
+ * @param process The process running the server
+ * @param temp_pool A pool to allocate temporary data from.
+ * @param config_name The name of the config file
+ * @param conftree Place to store the root of the config tree
+ * @return The setup server_rec list.
+ *}
+function ap_read_config(process: Pprocess_rec;
+                        temp_pool: Papr_pool_t;
+                        const config_name: PChar;
+                        conftree: PPap_directive_t): Pserver_rec;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_read_config' + LibSuff16;
+
+{**
+ * Run all rewrite args hooks for loaded modules
+ * @param process The process currently running the server
+ *}
+procedure ap_run_rewrite_args(process: Pprocess_rec);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_run_rewrite_args' + LibSuff4;
+
+{**
+ * Run the register hooks function for a specified module
+ * @param m The module to run the register hooks function fo
+ * @param p The pool valid for the lifetime of the module
+ *}
+procedure ap_register_hooks(m: Pmodule; p: Papr_pool_t);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_register_hooks' + LibSuff8;
+
+{**
+ * Setup all virtual hosts
+ * @param p The pool to allocate from
+ * @param main_server The head of the server_rec list
+ *}
+procedure ap_fixup_virtual_hosts(p: Papr_pool_t;
+                                 main_server: Pserver_rec);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_fixup_virtual_hosts' + LibSuff8;
+
+{**
+ * Reserve some modules slots for modules loaded by other means than
+ * EXEC_ON_READ directives.
+ * Relevant modules should call this in the pre_config stage.
+ * @param count The number of slots to reserve.
+ *}
+procedure ap_reserve_module_slots(count: Longint);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_reserve_module_slots' + LibSuff4;
+
+{**
+ * Reserve some modules slots for modules loaded by a specific
+ * non-EXEC_ON_READ config directive.
+ * This counts how often the given directive is used in the config and calls
+ * ap_reserve_module_slots() accordingly.
+ * @param directive The name of the directive
+ *}
+procedure ap_reserve_module_slots_directive(const directive: PChar);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_reserve_module_slots_directive' + LibSuff4;
+
+{* For http_request.c... *}
+
+{**
+ * Setup the config vector for a request_rec
+ * @param p The pool to allocate the config vector from
+ * @return The config vector
+ *}
+function ap_create_request_config(p: Papr_pool_t): Pap_conf_vector_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_create_request_config' + LibSuff4;
+
+{**
+ * Setup the config vector for per dir module configs
+ * @param p The pool to allocate the config vector from
+ * @return The config vector
+ *}
+//AP_CORE_DECLARE(ap_conf_vector_t *) ap_create_per_dir_config(apr_pool_t *p);
+function ap_create_per_dir_config(p: Papr_pool_t): Pap_conf_vector_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_create_per_dir_config' + LibSuff4;
+
+{**
+ * Run all of the modules merge per dir config functions
+ * @param p The pool to pass to the merge functions
+ * @param base The base directory config structure
+ * @param new_conf The new directory config structure
+ *}
+function ap_merge_per_dir_configs(p: Papr_pool_t;
+                                  base,
+                                  new_conf: Pap_conf_vector_t): Pap_conf_vector_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_merge_per_dir_configs' + LibSuff12;
+
+{**
+ * Allocate new ap_logconf and make (deep) copy of old ap_logconf
+ * @param p The pool to alloc from
+ * @param old The ap_logconf to copy (may be NULL)
+ * @return The new ap_logconf struct
+ *}
+function ap_new_log_config(p: Papr_pool_t;
+                           const old: Pap_logconf): Pap_logconf;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_new_log_config' + LibSuff8;
+
+{**
+ * Merge old ap_logconf into new ap_logconf.
+ * old and new must have the same life time.
+ * @param old_conf The ap_logconf to merge from
+ * @param new_conf The ap_logconf to merge into
+ *}
+procedure ap_merge_log_config(const old_conf: Pap_logconf;
+                              new_conf: Pap_logconf);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_merge_log_config' + LibSuff8;
+
+{* For http_connection.c... *}
+{**
+ * Setup the config vector for a connection_rec
+ * @param p The pool to allocate the config vector from
+ * @return The config vector
+ *}
+function ap_create_conn_config(p: Papr_pool_t): Pap_conf_vector_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_create_conn_config' + LibSuff4;
+
+{* For http_core.c... (&lt;Directory&gt; command and virtual hosts) *}
+
+{**
+ * parse an htaccess file
+ * @param result htaccess_result
+ * @param r The request currently being served
+ * @param override Which overrides are active
+ * @param override_opts Which allow-override-opts bits are set
+ * @param override_list Table of directives allowed for override
+ * @param path The path to the htaccess file
+ * @param access_name The list of possible names for .htaccess files
+ * int The status of the current request
+ *}
+function ap_parse_htaccess(result_: PPap_conf_vector_t;
+                           r: Prequest_rec;
+                           override_: Longint;
+                           override_opts: Longint;
+                           override_list: Papr_table_t;
+                           const path: PChar;
+                           const access_name: PChar): Longint;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_parse_htaccess' + LibSuff28;
+
+{**
+ * Setup a virtual host
+ * @param p The pool to allocate all memory from
+ * @param hostname The hostname of the virtual hsot
+ * @param main_server The main server for this Apache configuration
+ * @param ps Place to store the new server_rec
+ * return Error string on error, NULL on success
+ *}
+function ap_init_virtual_host(p: Papr_pool_t;
+                              const hostname: PChar;
+                              main_server: Pserver_rec;
+                              ps: PPserver_rec): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_init_virtual_host' + LibSuff16;
+
+{**
+ * Process a config file for Apache
+ * @param s The server rec to use for the command parms
+ * @param fname The name of the config file
+ * @param conftree The root node of the created config tree
+ * @param p Pool for general allocation
+ * @param ptemp Pool for temporary allocation
+ *}
+function ap_process_resource_config(s: Pserver_rec;
+                                    const fname: PChar;
+                                    conftree: PPap_directive_t;
+                                    p, ptemp: Papr_pool_t): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_process_resource_config' + LibSuff20;
+
+{**
+ * Process all matching files as Apache configs
+ * @param s The server rec to use for the command parms
+ * @param fname The filename pattern of the config file
+ * @param conftree The root node of the created config tree
+ * @param p Pool for general allocation
+ * @param ptemp Pool for temporary allocation
+ * @param optional Whether a no-match wildcard is allowed
+ * @see apr_fnmatch for pattern handling
+ *}
+function ap_process_fnmatch_configs(s: Pserver_rec;
+                                    const fname: PChar;
+                                    conftree: PPap_directive_t;
+                                    p, ptemp: Papr_pool_t;
+                                    optional: Longint): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_process_fnmatch_configs' + LibSuff24;
+
+{**
+ * Process all directives in the config tree
+ * @param s The server rec to use in the command parms
+ * @param conftree The config tree to process
+ * @param p The pool for general allocation
+ * @param ptemp The pool for temporary allocations
+ * @return OK if no problems
+ *}
+function ap_process_config_tree(s: Pserver_rec;
+                                conftree: Pap_directive_t;
+                                p, ptemp: Papr_pool_t): Longint;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_process_config_tree' + LibSuff16;
+
+{**
+ * Store data which will be retained across unload/load of modules
+ * @param key The unique key associated with this module's retained data
+ * @param size in bytes of the retained data (to be allocated)
+ * @return Address of new retained data structure, initially cleared
+ *}
+function ap_retained_data_create(const key: Pchar; size: apr_size_t): Pointer;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_retained_data_create' + LibSuff8;
+
+{**
+ * Retrieve data which was stored by ap_retained_data_create()
+ * @param key The unique key associated with this module's retained data
+ * @return Address of previously retained data structure, or NULL if not yet saved
+ *}
+function ap_retained_data_get(const key: Pchar): Pointer;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_retained_data_get' + LibSuff4;
+
+{* Module-method dispatchers, also for http_request.c *}
+{**
+ * Run the handler phase of each module until a module accepts the
+ * responsibility of serving the request
+ * @param r The current request
+ * @return The status of the current request
+ *}
+function ap_invoke_handler(r: Prequest_rec): Longint;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_invoke_handler' + LibSuff4;
+
+{* for mod_perl *}
+
+{**
+ * Find a given directive in a command_rec table
+ * @param name The directive to search for
+ * @param cmds The table to search
+ * @return The directive definition of the specified directive
+ *}
+function ap_find_command(const name: PChar;
+                         const cmds: Pcommand_rec): Pcommand_rec;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_find_command' + LibSuff8;
+
+{**
+ * Find a given directive in a list of modules.
+ * @param cmd_name The directive to search for
+ * @param mod Pointer to the first module in the linked list; will be set to
+ *            the module providing cmd_name
+ * @return The directive definition of the specified directive.
+ *         *mod will be changed to point to the module containing the
+ *         directive.
+ *}
+function ap_find_command_in_modules(const cmd_name: PChar;
+                                    mod_: PPmodule): Pcommand_rec;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_find_command_in_modules' + LibSuff8;
+
+{**
+ * Ask a module to create per-server and per-section (dir/loc/file) configs
+ * (if it hasn't happened already). The results are stored in the server's
+ * config, and the specified per-section config vector.
+ * @param server The server to operate upon.
+ * @param section_vector The per-section config vector.
+ * @param section Which section to create a config for.
+ * @param mod The module which is defining the config data.
+ * @param pconf A pool for all configuration allocations.
+ * @return The (new) per-section config data.
+ *}
+function ap_set_config_vectors(server: Pserver_rec;
+                               section_vector: Pap_conf_vector_t;
+                               const section: PChar;
+                               mod_: Pmodule;
+                               pconf: Papr_pool_t): Pointer;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_set_config_vectors' + LibSuff20;
+
+  {* Hooks *}
+
+{**
+ * Run the header parser functions for each module
+ * @param r The current request
+ * @return OK or DECLINED
+ *}
+//AP_DECLARE_HOOK(int,header_parser,(request_rec *r))
+(*macro expanded:
+ typedef
+  int ap_HOOK_header_parser_t (request_rec *r);
+  void ap_hook_header_parser(ap_HOOK_header_parser_t *pf,
+                             const char * const *aszPre,
+                             const char * const *aszSucc,
+                             int nOrder);
+
+  int ap_run_header_parser (request_rec *r);
+
+  apr_array_header_t * ap_hook_get_header_parser(void);
+
+  struct ap_LINK_header_parser_t {
+    ap_HOOK_header_parser_t *pFunc;
+    const char *szName;
+    const char * const *aszPredecessors;
+    const char * const *aszSuccessors;
+    int nOrder;
+  } ap_LINK_header_parser_t;
+*)
+type
+  ap_HOOK_header_parser_t = function(r: Prequest_rec): Longint; cdecl;
+  procedure ap_hook_header_parser(pf: ap_HOOK_header_parser_t;
+                                  const aszPre: PPChar;
+                                  const aszSucc: PPChar;
+                                  nOrder: Longint);
+    {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+    external LibHTTPD name LibNamePrefix + 'ap_hook_header_parser' + LibSuff16;
+
+  function ap_run_header_parser(r: Prequest_rec): Longint;
+    {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+    external LibHTTPD name LibNamePrefix + 'ap_run_header_parser' + LibSuff4;
+
+  function ap_hook_get_header_parser: Papr_array_header_t;
+    {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+    external LibHTTPD name LibNamePrefix + 'ap_hook_get_header_parser' + LibSuff0;
+
+  {rest of macro is ignored (struct ap_LINK_header_parser_t)}
+
+{**
+ * Run the pre_config function for each module
+ * @param pconf The config pool
+ * @param plog The logging streams pool
+ * @param ptemp The temporary pool
+ * @return OK or DECLINED on success anything else is a error
+ *}
+//AP_DECLARE_HOOK(int,pre_config,(apr_pool_t *pconf,apr_pool_t *plog,
+//                                apr_pool_t *ptemp))
+(*macro expanded:
+  typedef
+   int ap_HOOK_pre_config_t (apr_pool_t *pconf,apr_pool_t *plog, apr_pool_t *ptemp);
+
+   void ap_hook_pre_config(ap_HOOK_pre_config_t *pf, const char * const *aszPre, const char * const *aszSucc, int nOrder);
+
+   int ap_run_pre_config (apr_pool_t *pconf,apr_pool_t *plog, apr_pool_t *ptemp);
+
+   apr_array_header_t * ap_hook_get_pre_config(void);
+
+   struct ap_LINK_pre_config_t { ap_HOOK_pre_config_t *pFunc; const char *szName; const char * const *aszPredecessors; const char * const *aszSuccessors; int nOrder; } ap_LINK_pre_config_t;
+*)
+type
+   ap_HOOK_pre_config_t = function(pconf, plog, ptemp: Papr_pool_t): Longint; cdecl;
+
+   procedure ap_hook_pre_config(pf: ap_HOOK_pre_config_t; const aszPre: PPChar; const aszSucc: PPChar; nOrder: Longint);
+     {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+     external LibHTTPD name LibNamePrefix + 'ap_hook_pre_config' + LibSuff16;
+
+   function ap_run_pre_config(pconf, plog, ptemp: Papr_pool_t): Longint;
+     {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+     external LibHTTPD name LibNamePrefix + 'ap_run_pre_config' + LibSuff12;
+
+   function ap_hook_get_pre_config: Papr_array_header_t;
+     {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+     external LibHTTPD name LibNamePrefix + 'ap_hook_get_pre_config' + LibSuff0;
+
+   {rest of macro is ignored}
+
+{**
+ * Run the check_config function for each module
+ * @param pconf The config pool
+ * @param plog The logging streams pool
+ * @param ptemp The temporary pool
+ * @param s the server to operate upon
+ * @return OK or DECLINED on success anything else is a error
+ *}
+//AP_DECLARE_HOOK(int,check_config,(apr_pool_t *pconf, apr_pool_t *plog,
+//                                  apr_pool_t *ptemp, server_rec *s))
+(*macro expanded:
+   int ap_HOOK_check_config_t (apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *ptemp, server_rec *s);
+   void ap_hook_check_config(ap_HOOK_check_config_t *pf, const char * const *aszPre, const char * const *aszSucc, int nOrder);
+
+   int ap_run_check_config (apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *ptemp, server_rec *s);
+
+   apr_array_header_t * ap_hook_get_check_config(void);
+
+   struct ap_LINK_check_config_t { ap_HOOK_check_config_t *pFunc; const char *szName; const char * const *aszPredecessors; const char * const *aszSuccessors; int nOrder; } ap_LINK_check_config_t;
+*)
+type
+   ap_HOOK_check_config_t = function(pconf, plog, ptemp: Papr_pool_t; s: Pserver_rec): Longint; cdecl;
+   procedure ap_hook_check_config(pf: ap_HOOK_check_config_t; const aszPre: PPChar; const aszSucc: PPChar; nOrder: Longint);
+     {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+     external LibHTTPD name LibNamePrefix + 'ap_hook_check_config' + LibSuff16;
+
+   function ap_run_check_config(pconf, plog, ptemp: Papr_pool_t; s: Pserver_rec): Longint;
+     {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+     external LibHTTPD name LibNamePrefix + 'ap_run_check_config' + LibSuff16;
+
+   function ap_hook_get_check_config: Papr_array_header_t;
+     {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+     external LibHTTPD name LibNamePrefix + 'ap_hook_get_check_config' + LibSuff0;
+
+   {rest of macro is ignored}
+
+{**
+ * Run the test_config function for each module; this hook is run
+ * only if the server was invoked to test the configuration syntax.
+ * @param pconf The config pool
+ * @param s The list of server_recs
+ * @note To avoid reordering problems due to different buffering, hook
+ *       functions should only apr_file_*() to print to stdout/stderr and
+ *       not simple printf()/fprintf().
+ *     
+ *}
+//AP_DECLARE_HOOK(void,test_config,(apr_pool_t *pconf, server_rec *s))
+(*macro expanded:
+   void ap_HOOK_test_config_t (apr_pool_t *pconf, server_rec *s);
+   void ap_hook_test_config(ap_HOOK_test_config_t *pf, const char * const *aszPre, const char * const *aszSucc, int nOrder);
+   void ap_run_test_config (apr_pool_t *pconf, server_rec *s);
+   apr_array_header_t * ap_hook_get_test_config(void);
+
+   typedef struct ap_LINK_test_config_t { ap_HOOK_test_config_t *pFunc; const char *szName; const char * const *aszPredecessors; const char * const *aszSuccessors; int nOrder; } ap_LINK_test_config_t;
+*)
+type
+  ap_HOOK_test_config_t = procedure(pconf: Papr_pool_t; s: Pserver_rec); cdecl;
+
+  procedure ap_hook_test_config(pf: ap_HOOK_test_config_t; const aszPre: PPChar; const aszSucc: PPChar; nOrder: Integer);
+    {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+    external LibHTTPD name LibNamePrefix + 'ap_hook_test_config' + LibSuff16;
+
+  procedure ap_run_test_config(pconf: Papr_pool_t; s: Pserver_rec);
+    {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+    external LibHTTPD name LibNamePrefix + 'ap_run_test_config' + LibSuff8;
+
+  function ap_hook_get_test_config: Papr_array_header_t;
+    {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+    external LibHTTPD name LibNamePrefix + 'ap_hook_get_test_config' + LibSuff0;
+
+  {rest of macro is ignored}
+
+{**
+ * Run the post_config function for each module
+ * @param pconf The config pool
+ * @param plog The logging streams pool
+ * @param ptemp The temporary pool
+ * @param s The list of server_recs
+ * @return OK or DECLINED on success anything else is a error
+ *}
+//AP_DECLARE_HOOK(int,post_config,(apr_pool_t *pconf,apr_pool_t *plog,
+//                                 apr_pool_t *ptemp,server_rec *s))
+(*macro expanded:
+  int ap_HOOK_post_config_t (apr_pool_t *pconf,apr_pool_t *plog, apr_pool_t *ptemp,server_rec *s);
+
+  void ap_hook_post_config(ap_HOOK_post_config_t *pf, const char * const *aszPre, const char * const *aszSucc, int nOrder);
+  int ap_run_post_config (apr_pool_t *pconf,apr_pool_t *plog, apr_pool_t *ptemp,server_rec *s);
+  apr_array_header_t * ap_hook_get_post_config(void);
+
+  struct ap_LINK_post_config_t { ap_HOOK_post_config_t *pFunc; const char *szName; const char * const *aszPredecessors; const char * const *aszSuccessors; int nOrder; } ap_LINK_post_config_t;
+*)
+type
+  ap_HOOK_post_config_t = function(pconf, plog, ptemp: Papr_pool_t; s: Pserver_rec): Longint; cdecl;
+
+  procedure ap_hook_post_config(pf: ap_HOOK_post_config_t; const aszPre: PPChar; const aszSucc: PPChar; nOrder: Integer);
+    {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+    external LibHTTPD name LibNamePrefix + 'ap_hook_post_config' + LibSuff16;
+
+  function ap_run_post_config(pconf, plog, ptemp: Papr_pool_t; s: Pserver_rec): Longint;
+    {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+    external LibHTTPD name LibNamePrefix + 'ap_run_post_config' + LibSuff16;
+
+  function ap_hook_get_post_config: Papr_array_header_t;
+    {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+    external LibHTTPD name LibNamePrefix + 'ap_hook_get_post_config' + LibSuff0;
+
+  {rest of macro is ignored}
+
+{**
+ * Run the open_logs functions for each module
+ * @param pconf The config pool
+ * @param plog The logging streams pool
+ * @param ptemp The temporary pool
+ * @param s The list of server_recs
+ * @return OK or DECLINED on success anything else is a error
+ *}
+//AP_DECLARE_HOOK(int,open_logs,(apr_pool_t *pconf,apr_pool_t *plog,
+//                               apr_pool_t *ptemp,server_rec *s))
+(*macro expanded:
+  int ap_HOOK_open_logs_t (apr_pool_t *pconf,apr_pool_t *plog, apr_pool_t *ptemp,server_rec *s);
+
+  void ap_hook_open_logs(ap_HOOK_open_logs_t *pf, const char * const *aszPre, const char * const *aszSucc, int nOrder);
+  int ap_run_open_logs (apr_pool_t *pconf,apr_pool_t *plog, apr_pool_t *ptemp,server_rec *s);
+  apr_array_header_t * ap_hook_get_open_logs(void);
+
+  struct ap_LINK_open_logs_t { ap_HOOK_open_logs_t *pFunc; const char *szName; const char * const *aszPredecessors; const char * const *aszSuccessors; int nOrder; } ap_LINK_open_logs_t;
+*)
+type
+  ap_HOOK_open_logs_t = function(pconf, plog, ptemp: Papr_pool_t; s: Pserver_rec): Longint; cdecl;
+
+  procedure ap_hook_open_logs(pf: ap_HOOK_open_logs_t; const aszPre: PPChar; const aszSucc: PPChar; nOrder: Integer);
+    {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+    external LibHTTPD name LibNamePrefix + 'ap_hook_open_logs' + LibSuff16;
+
+  function ap_run_open_logs(pconf, plog, ptemp: Papr_pool_t; s: Pserver_rec): Longint;
+    {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+    external LibHTTPD name LibNamePrefix + 'ap_run_open_logs' + LibSuff16;
+
+  function ap_hook_get_open_logs: Papr_array_header_t;
+    {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+    external LibHTTPD name LibNamePrefix + 'ap_hook_get_open_logs' + LibSuff0;
+
+  {rest of macro is ignored}
+
+{**
+ * Run the child_init functions for each module
+ * @param pchild The child pool
+ * @param s The list of server_recs in this server
+ *}
+//AP_DECLARE_HOOK(void,child_init,(apr_pool_t *pchild, server_rec *s))
+(*macro expanded:
+  void ap_HOOK_child_init_t (apr_pool_t *pchild, server_rec *s);
+
+  void ap_hook_child_init(ap_HOOK_child_init_t *pf, const char * const *aszPre, const char * const *aszSucc, int nOrder);
+  void ap_run_child_init (apr_pool_t *pchild, server_rec *s);
+  apr_array_header_t * ap_hook_get_child_init(void);
+
+  struct ap_LINK_child_init_t { ap_HOOK_child_init_t *pFunc; const char *szName; const char * const *aszPredecessors; const char * const *aszSuccessors; int nOrder; } ap_LINK_child_init_t;
+*)
+type
+  ap_HOOK_child_init_t = procedure(pchild: Papr_pool_t; s: Pserver_rec); cdecl;
+
+  procedure ap_hook_child_init(pf: ap_HOOK_child_init_t; const aszPre: PPChar; const aszSucc: PPChar; nOrder: Integer);
+    {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+    external LibHTTPD name LibNamePrefix + 'ap_hook_child_init' + LibSuff16;
+
+  procedure ap_run_child_init(pchild: Papr_pool_t; s: Pserver_rec);
+    {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+    external LibHTTPD name LibNamePrefix + 'ap_run_child_init' + LibSuff8;
+
+  function ap_hook_get_child_init: Papr_array_header_t;
+    {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+    external LibHTTPD name LibNamePrefix + 'ap_hook_get_child_init' + LibSuff0;
+
+  {rest of macro is ignored}
+
+{**
+ * Run the handler functions for each module
+ * @param r The request_rec
+ * @remark non-wildcard handlers should HOOK_MIDDLE, wildcard HOOK_LAST
+ *}
+//AP_DECLARE_HOOK(int,handler,(request_rec *r))
+(*macro expanded:
+    int ap_HOOK_handler_t (request_rec *r);
+
+    void ap_hook_handler(ap_HOOK_handler_t *pf, const char * const *aszPre, const char * const *aszSucc, int nOrder);
+    int ap_run_handler (request_rec *r);
+    apr_array_header_t * ap_hook_get_handler(void);
+
+    struct ap_LINK_handler_t { ap_HOOK_handler_t *pFunc; const char *szName; const char * const *aszPredecessors; const char * const *aszSuccessors; int nOrder; } ap_LINK_handler_t;
+*)
+type
+  ap_HOOK_handler_t = function(r: Prequest_rec): Longint; cdecl;
+
+  procedure ap_hook_handler(pf: ap_HOOK_handler_t; const aszPre: PPChar; const aszSucc: PPChar; nOrder: Integer);
+    {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+    external LibHTTPD name LibNamePrefix + 'ap_hook_handler' + LibSuff16;
+
+  function ap_run_handler(r: Prequest_rec): Longint;
+    {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+    external LibHTTPD name LibNamePrefix + 'ap_run_handler' + LibSuff4;
+
+  function ap_hook_get_handler: Papr_array_header_t;
+    {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+    external LibHTTPD name LibNamePrefix + 'ap_hook_get_handler' + LibSuff0;
+
+  {rest of macro is ignored}
+
+{**
+ * Run the quick handler functions for each module. The quick_handler
+ * is run before any other requests hooks are called (location_walk,
+ * directory_walk, access checking, et. al.). This hook was added
+ * to provide a quick way to serve content from a URI keyed cache.
+ *
+ * @param r The request_rec
+ * @param lookup_uri Controls whether the caller actually wants content or not.
+ * lookup is set when the quick_handler is called out of
+ * ap_sub_req_lookup_uri()
+ *}
+//AP_DECLARE_HOOK(int,quick_handler,(request_rec *r, int lookup_uri))
+(*macro expanded:
+  int ap_HOOK_quick_handler_t (request_rec *r, int lookup_uri);
+
+  void ap_hook_quick_handler(ap_HOOK_quick_handler_t *pf, const char * const *aszPre, const char * const *aszSucc, int nOrder);
+  int ap_run_quick_handler (request_rec *r, int lookup_uri);
+  apr_array_header_t * ap_hook_get_quick_handler(void);
+
+  struct ap_LINK_quick_handler_t { ap_HOOK_quick_handler_t *pFunc; const char *szName; const char * const *aszPredecessors; const char * const *aszSuccessors; int nOrder; } ap_LINK_quick_handler_t;
+*)
+type
+  ap_HOOK_quick_handler_t = function(r: Prequest_rec; lookup_uri: Longint): Longint; cdecl;
+
+  procedure ap_hook_quick_handler(pf: ap_HOOK_quick_handler_t; const aszPre: PPChar; const aszSucc: PPChar; nOrder: Integer);
+    {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+    external LibHTTPD name LibNamePrefix + 'ap_hook_quick_handler' + LibSuff16;
+
+  function ap_run_quick_handler(r: Prequest_rec; lookup_uri: Longint): Longint;
+    {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+    external LibHTTPD name LibNamePrefix + 'ap_run_quick_handler' + LibSuff8;
+
+  function ap_hook_get_quick_handler: Papr_array_header_t;
+    {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+    external LibHTTPD name LibNamePrefix + 'ap_hook_get_quick_handler' + LibSuff0;
+
+  {rest of macro is ignored}
+
+{**
+ * Retrieve the optional functions for each module.
+ * This is run immediately before the server starts. Optional functions should
+ * be registered during the hook registration phase.
+ *}
+//AP_DECLARE_HOOK(void,optional_fn_retrieve,(void))
+(*macro expanded:
+  void ap_HOOK_optional_fn_retrieve_t (void);
+
+  void ap_hook_optional_fn_retrieve(ap_HOOK_optional_fn_retrieve_t *pf, const char * const *aszPre, const char * const *aszSucc, int nOrder);
+  void ap_run_optional_fn_retrieve (void);
+  apr_array_header_t * ap_hook_get_optional_fn_retrieve(void);
+
+  struct ap_LINK_optional_fn_retrieve_t { ap_HOOK_optional_fn_retrieve_t *pFunc; const char *szName; const char * const *aszPredecessors; const char * const *aszSuccessors; int nOrder; } ap_LINK_optional_fn_retrieve_t;
+*)
+type
+  ap_HOOK_optional_fn_retrieve_t = procedure; cdecl;
+
+  procedure ap_hook_optional_fn_retrieve(pf: ap_HOOK_optional_fn_retrieve_t; const aszPre: PPChar; const aszSucc: PPChar; nOrder: Integer);
+    {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+    external LibHTTPD name LibNamePrefix + 'ap_hook_optional_fn_retrieve' + LibSuff16;
+
+  procedure ap_run_optional_fn_retrieve;
+    {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+    external LibHTTPD name LibNamePrefix + 'ap_run_optional_fn_retrieve' + LibSuff0;
+
+  function ap_hook_get_optional_fn_retrieve: Papr_array_header_t;
+    {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+    external LibHTTPD name LibNamePrefix + 'ap_hook_get_optional_fn_retrieve' + LibSuff0;
+
+  {rest of macro is ignored}
+
+{**
+ * A generic pool cleanup that will reset a pointer to NULL. For use with
+ * apr_pool_cleanup_register.
+ * @param data The address of the pointer
+ * @return APR_SUCCESS
+ *}
+//AP_DECLARE_NONSTD(apr_status_t) ap_pool_cleanup_set_null(void *data);
+function ap_pool_cleanup_set_null(data: Pointer): apr_status_t; cdecl;
+  external LibHTTPD name LibNamePrefix + 'ap_pool_cleanup_set_null';
+
+{$endif}  {* !APACHE_HTTP_CONFIG_H *}
+(** @} *)

+ 1122 - 0
packages/httpd24/src/http_core.inc

@@ -0,0 +1,1122 @@
+{* 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.
+ *}
+
+(**
+ * @file  http_core.h
+ * @brief CORE HTTP Daemon
+ *
+ * @defgroup APACHE_CORE_HTTPD Core HTTP Daemon
+ * @ingroup  APACHE_CORE
+ * @{
+ *)
+
+//#ifndef APACHE_HTTP_CORE_H
+//#define APACHE_HTTP_CORE_H
+
+//#include "apr.h"
+//#include "apr_hash.h"
+//#include "apr_optional.h"
+{$include util_filter.inc}
+{$include ap_expr.inc}
+//#include "apr_tables.h"
+
+//#include "http_config.h"
+
+//#if APR_HAVE_STRUCT_RLIMIT
+//#include <sys/time.h>
+//#include <sys/resource.h>
+//#endif
+
+
+{* ****************************************************************
+ *
+ * The most basic server code is encapsulated in a single module
+ * known as the core, which is just *barely* functional enough to
+ * serve documents, though not terribly well.
+ *
+ * Largely for NCSA back-compatibility reasons, the core needs to
+ * make pieces of its config structures available to other modules.
+ * The accessors are declared here, along with the interpretation
+ * of one of them (allow_options).
+ *}
+
+(**
+ * @defgroup APACHE_CORE_HTTPD_ACESSORS Acessors
+ *
+ * @brief File/Directory Accessor directives
+ *
+ * @{
+ *)
+const
+//** No directives */
+  OPT_NONE          = 0;
+//** Indexes directive */
+  OPT_INDEXES       = 1;
+//** SSI is enabled without exec= permission  */
+  OPT_INCLUDES      = 2;
+//**  FollowSymLinks directive */
+  OPT_SYM_LINKS     = 4;
+//**  ExecCGI directive */
+  OPT_EXECCGI       = 8;
+//**  directive unset */
+  OPT_UNSET         = 16;
+//**  SSI exec= permission is permitted, iff OPT_INCLUDES is also set */
+  OPT_INC_WITH_EXEC = 32;
+//** SymLinksIfOwnerMatch directive */
+  OPT_SYM_OWNER     = 64;
+//** MultiViews directive */
+  OPT_MULTI         = 128;
+//**  All directives */
+  OPT_ALL           = (OPT_INDEXES or OPT_INCLUDES or OPT_INC_WITH_EXEC or OPT_SYM_LINKS or OPT_EXECCGI);
+(** @} *)
+
+(**
+ * @defgroup get_remote_host Remote Host Resolution
+ * @ingroup APACHE_CORE_HTTPD
+ * @{
+ *)
+{** REMOTE_HOST returns the hostname, or NULL if the hostname
+ * lookup fails.  It will force a DNS lookup according to the
+ * HostnameLookups setting.
+ *}
+  REMOTE_HOST = 0;
+
+{** REMOTE_NAME returns the hostname, or the dotted quad if the
+ * hostname lookup fails.  It will force a DNS lookup according
+ * to the HostnameLookups setting.
+ *}
+  REMOTE_NAME = 1;
+
+{** REMOTE_NOLOOKUP is like REMOTE_NAME except that a DNS lookup is
+ * never forced.
+ *}
+  REMOTE_NOLOOKUP = 2;
+
+{** REMOTE_DOUBLE_REV will always force a DNS lookup, and also force
+ * a double reverse lookup, regardless of the HostnameLookups
+ * setting.  The result is the (double reverse checked) hostname,
+ * or NULL if any of the lookups fail.
+ *}
+  REMOTE_DOUBLE_REV = 3;
+
+(** @} // get_remote_host *)
+
+//** all of the requirements must be met */
+  SATISFY_ALL = 0;
+//**  any of the requirements must be met */
+  SATISFY_ANY = 1;
+//** There are no applicable satisfy lines */
+  SATISFY_NOSPEC = 2;
+
+{** Make sure we don't write less than 8000 bytes at any one time.
+ *}
+  AP_MIN_BYTES_TO_WRITE  = 8000;
+
+//** default maximum of internal redirects */
+  AP_DEFAULT_MAX_INTERNAL_REDIRECTS  = 10;
+
+//** default maximum subrequest nesting level */
+  AP_DEFAULT_MAX_SUBREQ_DEPTH = 10;
+
+(**
+ * Retrieve the value of Options for this request
+ * @param r The current request
+ * @return the Options bitmask
+ *)
+//AP_DECLARE(int) ap_allow_options(request_rec *r);
+function ap_allow_options(r: Prequest_rec): Integer;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name LibNamePrefix + 'ap_allow_options' + LibSuff4;
+
+{**
+ * Retrieve the value of the AllowOverride for this request
+ * @param r The current request
+ * @return the overrides bitmask
+ *}
+//AP_DECLARE(int) ap_allow_overrides(request_rec *r);
+function ap_allow_overrides(r: Prequest_rec): Integer;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name LibNamePrefix + 'ap_allow_overrides' + LibSuff4;
+
+{**
+ * Retrieve the document root for this server
+ * @param r The current request
+ * @warning Don't use this!  If your request went through a Userdir, or
+ * something like that, it'll screw you.  But it's back-compatible...
+ * @return The document root
+ *}
+//AP_DECLARE(const char *) ap_document_root(request_rec *r);
+function ap_document_root(r: Prequest_rec): PChar;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name LibNamePrefix + 'ap_document_root' + LibSuff4;
+
+{**
+ * Lookup the remote client's DNS name or IP address
+ * @ingroup get_remote_host
+ * @param conn The current connection
+ * @param dir_config The directory config vector from the request
+ * @param type The type of lookup to perform.  One of:
+ * <pre>
+ *     REMOTE_HOST returns the hostname, or NULL if the hostname
+ *                 lookup fails.  It will force a DNS lookup according to the
+ *                 HostnameLookups setting.
+ *     REMOTE_NAME returns the hostname, or the dotted quad if the
+ *                 hostname lookup fails.  It will force a DNS lookup according
+ *                 to the HostnameLookups setting.
+ *     REMOTE_NOLOOKUP is like REMOTE_NAME except that a DNS lookup is
+ *                     never forced.
+ *     REMOTE_DOUBLE_REV will always force a DNS lookup, and also force
+ *                   a double reverse lookup, regardless of the HostnameLookups
+ *                   setting.  The result is the (double reverse checked)
+ *                   hostname, or NULL if any of the lookups fail.
+ * </pre>
+ * @param str_is_ip unless NULL is passed, this will be set to non-zero on output when an IP address
+ *        string is returned
+ * @return The remote hostname
+ *}
+//AP_DECLARE(const char *) ap_get_remote_host(conn_rec *conn, void *dir_config, int type, int *str_is_ip);
+function ap_get_remote_host(conn: Pconn_rec; dir_config: Pointer; _type: Integer; str_is_ip: PInteger): PChar;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name LibNamePrefix + 'ap_get_remote_host' + LibSuff16;
+
+{**
+ * Retrieve the login name of the remote user.  Undef if it could not be
+ * determined
+ * @param r The current request
+ * @return The user logged in to the client machine
+ *}
+//AP_DECLARE(const char *) ap_get_remote_logname(request_rec *r);
+function ap_get_remote_logname(r: Prequest_rec): PChar;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name LibNamePrefix + 'ap_get_remote_logname' + LibSuff4;
+
+{* Used for constructing self-referencing URLs, and things like SERVER_PORT,
+ * and SERVER_NAME.
+ *}
+{**
+ * build a fully qualified URL from the uri and information in the request rec
+ * @param p The pool to allocate the URL from
+ * @param uri The path to the requested file
+ * @param r The current request
+ * @return A fully qualified URL
+ *}
+//AP_DECLARE(char *) ap_construct_url(apr_pool_t *p, const char *uri, request_rec *r);
+function ap_construct_url(p: Papr_pool_t; const uri: PChar; r: Prequest_rec): PChar;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name LibNamePrefix + 'ap_construct_url' + LibSuff12;
+
+{**
+ * Get the current server name from the request
+ * @param r The current request
+ * @return the server name
+ *}
+//AP_DECLARE(const char *) ap_get_server_name(request_rec *r);
+function ap_get_server_name(r: Prequest_rec): PChar;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name LibNamePrefix + 'ap_get_server_name' + LibSuff4;
+
+{**
+ * Get the current server name from the request for the purposes
+ * of using in a URL.  If the server name is an IPv6 literal
+ * address, it will be returned in URL format (e.g., "[fe80::1]").
+ * @param r The current request
+ * @return the server name
+ *}
+//AP_DECLARE(const char *) ap_get_server_name_for_url(request_rec *r);
+function ap_get_server_name_for_url(r: Prequest_rec): PChar;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name LibNamePrefix + 'ap_get_server_name_for_url' + LibSuff4;
+
+{**
+ * Get the current server port
+ * @param r The current request
+ * @return The server's port
+ *}
+//AP_DECLARE(apr_port_t) ap_get_server_port(const request_rec *r);
+function ap_get_server_port(r: Prequest_rec): apr_port_t;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name LibNamePrefix + 'ap_get_server_port' + LibSuff4;
+
+{**
+ * Return the limit on bytes in request msg body
+ * @param r The current request
+ * @return the maximum number of bytes in the request msg body
+ *}
+//AP_DECLARE(apr_off_t) ap_get_limit_req_body(const request_rec *r);
+function ap_get_limit_req_body(r: Prequest_rec): apr_off_t;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name LibNamePrefix + 'ap_get_limit_req_body' + LibSuff4;
+
+{**
+ * Return the limit on bytes in XML request msg body
+ * @param r The current request
+ * @return the maximum number of bytes in XML request msg body
+ *}
+//AP_DECLARE(apr_size_t) ap_get_limit_xml_body(const request_rec *r);
+function ap_get_limit_xml_body(r: Prequest_rec): apr_size_t;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name LibNamePrefix + 'ap_get_limit_xml_body' + LibSuff4;
+
+{**
+ * Install a custom response handler for a given status
+ * @param r The current request
+ * @param status The status for which the custom response should be used
+ * @param string The custom response.  This can be a static string, a file
+ *               or a URL
+ *}
+//AP_DECLARE(void) ap_custom_response(request_rec *r, int status, const char *string);
+procedure ap_custom_response(r: Prequest_rec; status: Integer; const string_: PChar);
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name LibNamePrefix + 'ap_custom_response' + LibSuff12;
+
+{**
+ * Check if the current request is beyond the configured max. number of redirects or subrequests
+ * @param r The current request
+ * @return true (is exceeded) or false
+ *}
+//AP_DECLARE(int) ap_is_recursion_limit_exceeded(const request_rec *r);
+function ap_is_recursion_limit_exceeded(const r: Prequest_rec): Integer;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name LibNamePrefix + 'ap_is_recursion_limit_exceeded' + LibSuff4;
+
+{**
+ * Check for a definition from the server command line
+ * @param name The define to check for
+ * @return 1 if defined, 0 otherwise
+ *}
+//AP_DECLARE(int) ap_exists_config_define(const char *name);
+function ap_exists_config_define(const name: PChar): Integer;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name LibNamePrefix + 'ap_exists_config_define' + LibSuff4;
+//* FIXME! See STATUS about how */
+//AP_DECLARE_NONSTD(int) ap_core_translate(request_rec *r);
+function ap_core_translate(r: Prequest_rec): Integer; cdecl;
+  external LibHTTPD name 'ap_core_translate';
+
+{* Authentication stuff.  This is one of the places where compatibility
+ * with the old config files *really* hurts; they don't discriminate at
+ * all between different authentication schemes, meaning that we need
+ * to maintain common state for all of them in the core, and make it
+ * available to the other modules through interfaces.
+ *}
+
+//** @see require_line */
+//typedef struct require_line require_line;
+type
+  Prequire_line = ^require_line;
+{**
+ * @brief A structure to keep track of authorization requirements
+*}
+  require_line = record
+    //** Where the require line is in the config file. */
+    method_mask: apr_int64_t;
+    //** The complete string from the command line */
+    requirement: PChar;
+ end;
+
+{**
+ * Return the type of authorization required for this request
+ * @param r The current request
+ * @return The authorization required
+ *}
+//AP_DECLARE(const char *) ap_auth_type(request_rec *r);
+function ap_auth_type(r: Prequest_rec): PChar;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name LibNamePrefix + 'ap_auth_type' + LibSuff4;
+
+{**
+ * Return the current Authorization realm
+ * @param r The current request
+ * @return The current authorization realm
+ *}
+//AP_DECLARE(const char *) ap_auth_name(request_rec *r);
+function ap_auth_name(r: Prequest_rec): PChar;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name LibNamePrefix + 'ap_auth_name' + LibSuff4;
+
+{**
+ * How the requires lines must be met.
+ * @param r The current request
+ * @return How the requirements must be met.  One of:
+ * <pre>
+ *      SATISFY_ANY    -- any of the requirements must be met.
+ *      SATISFY_ALL    -- all of the requirements must be met.
+ *      SATISFY_NOSPEC -- There are no applicable satisfy lines
+ * </pre>
+ *}
+//AP_DECLARE(int) ap_satisfies(request_rec *r);
+function ap_satisfies(r: Prequest_rec): Integer;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name LibNamePrefix + 'ap_satisfies' + LibSuff4;
+
+{**
+ * Core is also unlike other modules in being implemented in more than
+ * one file... so, data structures are declared here, even though most of
+ * the code that cares really is in http_core.c.  Also, another accessor.
+ *}
+//AP_DECLARE_DATA extern module core_module;
+
+{**
+ * Accessor for core_module's specific data. Equivalent to
+ * ap_get_module_config(cv, &core_module) but more efficient.
+ * @param cv The vector in which the modules configuration is stored.
+ *        usually r->per_dir_config or s->module_config
+ * @return The module-specific data
+ *}
+//AP_DECLARE(void *) ap_get_core_module_config(const ap_conf_vector_t *cv);
+{not found in httpd binary libraries, ignored}
+
+{**
+ * Accessor to set core_module's specific data. Equivalent to
+ * ap_set_module_config(cv, &core_module, val) but more efficient.
+ * @param cv The vector in which the modules configuration is stored.
+ *        usually r->per_dir_config or s->module_config
+ * @param val The module-specific data to set
+ *}
+//AP_DECLARE(void) ap_set_core_module_config(ap_conf_vector_t *cv, void *val);
+{not found in httpd binary libraries, ignored}
+
+{** Get the socket from the core network filter. This should be used instead of
+ * accessing the core connection config directly.
+ * @param c The connection record
+ * @return The socket
+ *}
+//AP_DECLARE(apr_socket_t *) ap_get_conn_socket(conn_rec *c);
+function ap_get_conn_socket(c: Pconn_rec): Integer;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name LibNamePrefix + 'ap_get_conn_socket' + LibSuff4;
+
+//#ifndef AP_DEBUG
+//#define AP_CORE_MODULE_INDEX  0
+//#define ap_get_core_module_config(v) \
+//    (((void **)(v))[AP_CORE_MODULE_INDEX])
+//#define ap_set_core_module_config(v, val) \
+//    ((((void **)(v))[AP_CORE_MODULE_INDEX]) = (val))
+//#else
+//#define AP_CORE_MODULE_INDEX  (AP_DEBUG_ASSERT(core_module.module_index == 0), 0)
+//#endif
+
+{**
+ * @brief  Per-request configuration
+*}
+type
+  core_request_config = record
+    {** bucket brigade used by getline for look-ahead and
+     * ap_get_client_block for holding left-over request body *}
+    bb: Papr_bucket_brigade;
+
+    {** an array of per-request working data elements, accessed
+     * by ID using ap_get_request_note()
+     * (Use ap_register_request_note() during initialization
+     * to add elements)
+     *}
+    notes: PPointer;
+
+    {** Custom response strings registered via ap_custom_response(),
+     * or NULL; check per-dir config if nothing found here
+     *}
+    response_code_strings: PPChar; {* from ap_custom_response(), not from
+                                    * ErrorDocument
+                                    *}
+
+    {** per-request document root of the server. This allows mass vhosting
+     * modules better compatibility with some scripts. Normally the
+     * context_* info should be used instead *}
+    document_root: PChar;
+
+    {*
+     * more fine-grained context information which is set by modules like
+     * mod_alias and mod_userdir
+     *}
+    {** the context root directory on disk for the current resource,
+     *  without trailing slash
+     *}
+    context_document_root: PChar;
+    {** the URI prefix that corresponds to the context_document_root directory,
+     *  without trailing slash
+     *}
+    context_prefix: PChar;
+
+    {** There is a script processor installed on the output filter chain,
+     * so it needs the default_handler to deliver a (script) file into
+     * the chain so it can process it. Normally, default_handler only
+     * serves files on a GET request (assuming the file is actual content),
+     * since other methods are not content-retrieval. This flag overrides
+     * that behavior, stating that the "content" is actually a script and
+     * won't actually be delivered as the response for the non-GET method.
+     *}
+    deliver_script: Integer;
+
+    {** Should addition of charset= be suppressed for this request?
+     *}
+    suppress_charset: Integer;
+  end;
+
+{* Standard entries that are guaranteed to be accessible via
+ * ap_get_request_note() for each request (additional entries
+ * can be added with ap_register_request_note())
+ *}
+const
+  AP_NOTE_DIRECTORY_WALK = 0;
+  AP_NOTE_LOCATION_WALK  = 1;
+  AP_NOTE_FILE_WALK      = 2;
+  AP_NOTE_IF_WALK        = 3;
+  AP_NUM_STD_NOTES       = 4;
+
+{**
+ * Reserve an element in the core_request_config->notes array
+ * for some application-specific data
+ * @return An integer key that can be passed to ap_get_request_note()
+ *         during request processing to access this element for the
+ *         current request.
+ *}
+//AP_DECLARE(apr_size_t) ap_register_request_note(void);
+function ap_register_request_note: apr_size_t;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name LibNamePrefix + 'ap_register_request_note' + LibSuff0;
+
+{**
+ * Retrieve a pointer to an element in the core_request_config->notes array
+ * @param r The request
+ * @param note_num  A key for the element: either a value obtained from
+ *        ap_register_request_note() or one of the predefined AP_NOTE_*
+ *        values.
+ * @return NULL if the note_num is invalid, otherwise a pointer to the
+ *         requested note element.
+ * @remark At the start of a request, each note element is NULL.  The
+ *         handle provided by ap_get_request_note() is a pointer-to-pointer
+ *         so that the caller can point the element to some app-specific
+ *         data structure.  The caller should guarantee that any such
+ *         structure will last as long as the request itself.
+ *}
+//AP_DECLARE(void **) ap_get_request_note(request_rec *r, apr_size_t note_num);
+ function ap_get_request_note(r: Prequest_rec; note_num: apr_size_t): PPointer;
+   {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+   external LibHTTPD name LibNamePrefix + 'ap_get_request_note' + LibSuff8;
+
+type
+//typedef unsigned char allow_options_t;
+  allow_options_t = cuchar;
+//typedef unsigned int overrides_t;
+  overrides_t = cuchar;
+
+{*
+ * Bits of info that go into making an ETag for a file
+ * document.  Why a long?  Because char historically
+ * proved too short for Options, and int can be different
+ * sizes on different platforms.
+ *}
+//typedef unsigned long etag_components_t;
+  etag_components_t = culong;
+
+const
+  ETAG_UNSET    = 0;
+  ETAG_NONE     = (1 shl 0);
+  ETAG_MTIME    = (1 shl 1);
+  ETAG_INODE    = (1 shl 2);
+  ETAG_SIZE     = (1 shl 3);
+  ETAG_ALL      = (ETAG_MTIME or ETAG_INODE or ETAG_SIZE);
+  //* This is the default value used */
+  ETAG_BACKWARD = (ETAG_MTIME or ETAG_SIZE);
+
+  //* Hostname resolution etc */
+  HOSTNAME_LOOKUP_OFF     = 0;
+  HOSTNAME_LOOKUP_ON      = 1;
+  HOSTNAME_LOOKUP_DOUBLE  = 2;
+  HOSTNAME_LOOKUP_UNSET   = 3;
+
+  USE_CANONICAL_NAME_OFF   = 0;
+  USE_CANONICAL_NAME_ON    = 1;
+  USE_CANONICAL_NAME_DNS   = 2;
+  USE_CANONICAL_NAME_UNSET = 3;
+
+  ADD_DEFAULT_CHARSET_OFF   = 0;
+  ADD_DEFAULT_CHARSET_ON    = 1;
+  ADD_DEFAULT_CHARSET_UNSET = 2;
+
+  ENABLE_MMAP_OFF    = 0;
+  ENABLE_MMAP_ON     = 1;
+  ENABLE_MMAP_UNSET  = 2;
+
+  ENABLE_SENDFILE_OFF    = 0;
+  ENABLE_SENDFILE_ON     = 1;
+  ENABLE_SENDFILE_UNSET  = 2;
+
+  USE_CANONICAL_PHYS_PORT_OFF   = 0;
+  USE_CANONICAL_PHYS_PORT_ON    = 1;
+  USE_CANONICAL_PHYS_PORT_UNSET = 2;
+
+  AP_CONDITION_IF        = 1;
+  AP_CONDITION_ELSE      = 2;
+  AP_CONDITION_ELSEIF    = (AP_CONDITION_ELSE or AP_CONDITION_IF);
+
+  AP_MAXRANGES_UNSET     = -1;
+  AP_MAXRANGES_DEFAULT   = -2;
+  AP_MAXRANGES_UNLIMITED = -3;
+  AP_MAXRANGES_NORANGES  =  0;
+
+{**
+ * @brief Server Signature Enumeration
+ *}
+type
+  server_signature_e = (
+    srv_sig_unset,
+    srv_sig_off,
+    srv_sig_on,
+    srv_sig_withmail
+  );
+
+{**
+ * @brief Per-directory configuration
+ *}
+  core_dir_config = record
+    //** path of the directory/regex/etc. see also d_is_fnmatch/absolute below */
+    d: PChar;
+    //** the number of slashes in d */
+    d_components: Cardinal;
+
+    {** If (opts & OPT_UNSET) then no absolute assignment to options has
+     * been made.
+     * invariant: (opts_add & opts_remove) == 0
+     * Which said another way means that the last relative (options + or -)
+     * assignment made to each bit is recorded in exactly one of opts_add
+     * or opts_remove.
+     *}
+    opts:          allow_options_t;
+    opts_add:      allow_options_t;
+    opts_remove:   allow_options_t;
+    override_:     overrides_t;
+    override_opts: allow_options_t;
+
+    {* Custom response config. These can contain text or a URL to redirect to.
+     * if response_code_strings is NULL then there are none in the config,
+     * if it's not null then it's allocated to sizeof(char*)*RESPONSE_CODES.
+     * This lets us do quick merges in merge_core_dir_configs().
+     *}
+
+    response_code_strings: PPChar;{* from ErrorDocument, not from
+                                   * ap_custom_response() *}
+
+    //* Hostname resolution etc */       {fpc -> consts are moved up}
+//#define HOSTNAME_LOOKUP_OFF     0
+//#define HOSTNAME_LOOKUP_ON      1
+//#define HOSTNAME_LOOKUP_DOUBLE  2
+//#define HOSTNAME_LOOKUP_UNSET   3
+    flags : cardinal; // takes care of  hostname_lookups, content_md5, use_canonical_name d_is_fnmatch and add_default_charset
+//    unsigned int hostname_lookups : 4;
+
+//    unsigned int content_md5 : 2;  //* calculate Content-MD5? */
+
+//#define USE_CANONICAL_NAME_OFF   (0)  {fpc -> consts are moved up}
+//#define USE_CANONICAL_NAME_ON    (1)
+//#define USE_CANONICAL_NAME_DNS   (2)
+//#define USE_CANONICAL_NAME_UNSET (3)
+//    unsigned use_canonical_name : 2;
+
+    {* since is_fnmatch(conf->d) was being called so frequently in
+     * directory_walk() and its relatives, this field was created and
+     * is set to the result of that call.
+     *}
+//    unsigned d_is_fnmatch : 1;
+
+    {* should we force a charset on any outgoing parameterless content-type?
+     * if so, which charset?
+     *}
+//#define ADD_DEFAULT_CHARSET_OFF   (0)  {fpc -> consts are moved up}
+//#define ADD_DEFAULT_CHARSET_ON    (1)
+//#define ADD_DEFAULT_CHARSET_UNSET (2)
+//    unsigned add_default_charset : 2;
+    add_default_charset_name: PChar;
+
+    //* System Resource Control */
+{$ifdef RLIMIT_CPU}
+    limit_cpu: Prlimit;
+{$endif}
+{$if defined(RLIMIT_DATA) or defined (RLIMIT_VMEM) or defined(RLIMIT_AS)}
+    limit_mem: Prlimit;
+{$endif}
+{$ifdef RLIMIT_NPROC}
+    limit_nproc: Prlimit;
+{$endif}
+    limit_req_body: apr_off_t;     //* limit on bytes in request msg body */
+    limit_xml_body: cLong;         //* limit on bytes in XML request msg body */
+
+    //* logging options */
+
+    server_signature: server_signature_e;
+
+    //* Access control */
+    sec_file: Papr_array_header_t;
+    sec_if:   Papr_array_header_t;
+    r: Pap_regex_t;
+
+    mime_type,                 //* forced with ForceType  */
+    handler,                   //* forced with SetHandler */
+    output_filters,            //* forced with SetOutputFilters */
+    input_filters: PChar;      //* forced with SetInputFilters */
+    accept_path_info: Integer; //* forced with AcceptPathInfo */
+
+    {*
+     * What attributes/data should be included in ETag generation?
+     *}
+    etag_bits:   etag_components_t;
+    etag_add:    etag_components_t;
+    etag_remove: etag_components_t;
+
+    {*
+     * Run-time performance tuning
+     *}
+//#define ENABLE_MMAP_OFF    (0)             {fpc -> consts are moved up}
+//#define ENABLE_MMAP_ON     (1)
+//#define ENABLE_MMAP_UNSET  (2)
+    flags2 : cardinal; // Takes care of   enable_mmap, enable_sendfile, use_canonical_phys_port,
+                       //                 allow_encoded_slashes, decode_encoded_slashes and condition_ifelse
+//    unsigned int enable_mmap : 2;  //* whether files in this dir can be mmap'ed */
+
+//#define ENABLE_SENDFILE_OFF    (0)         {fpc -> consts are moved up}
+//#define ENABLE_SENDFILE_ON     (1)
+//#define ENABLE_SENDFILE_UNSET  (2)
+//    unsigned int enable_sendfile : 2;  //* files in this dir can be sendfile'ed */
+
+//#define USE_CANONICAL_PHYS_PORT_OFF   (0)  {fpc -> consts are moved up}
+//#define USE_CANONICAL_PHYS_PORT_ON    (1)
+//#define USE_CANONICAL_PHYS_PORT_UNSET (2)
+//    unsigned int use_canonical_phys_port : 2;
+
+//    unsigned int allow_encoded_slashes : 1; {* URLs may contain %2f w/o being
+                                             //* pitched indiscriminately *}
+//    unsigned int decode_encoded_slashes : 1; //* whether to decode encoded slashes in URLs */
+
+//#define AP_CONDITION_IF        1           {fpc -> consts are moved up}
+//#define AP_CONDITION_ELSE      2
+//#define AP_CONDITION_ELSEIF    (AP_CONDITION_ELSE|AP_CONDITION_IF)
+//    unsigned int condition_ifelse : 2; //* is this an <If>, <ElseIf>, or <Else> */
+
+    condition: Pap_expr_info_t;   //* Conditionally merge <If> sections */
+
+    //** per-dir log config */
+    log: Pap_logconf;
+
+    //** Table of directives allowed per AllowOverrideList */
+    override_list: Papr_table_t;
+
+//#define AP_MAXRANGES_UNSET     -1          {fpc -> consts are moved up}
+//#define AP_MAXRANGES_DEFAULT   -2
+//#define AP_MAXRANGES_UNLIMITED -3
+//#define AP_MAXRANGES_NORANGES   0
+    //** Number of Ranges before returning HTTP_OK. **/
+    max_ranges: Integer;
+    //** Max number of Range overlaps (merges) allowed **/
+    max_overlaps: Integer;
+    //** Max number of Range reversals (eg: 200-300, 100-125) allowed **/
+    max_reversals: Integer;
+
+  end; {core_dir_config}
+
+//* macro to implement off by default behaviour */
+//#define AP_SENDFILE_ENABLED(x) \
+//    ((x) == ENABLE_SENDFILE_ON ? APR_SENDFILE_ENABLED : 0)
+
+//* Per-server core configuration */
+const
+      //* TRACE control */
+  AP_TRACE_UNSET    = -1;
+  AP_TRACE_DISABLE  =  0;
+  AP_TRACE_ENABLE   =  1;
+  AP_TRACE_EXTENDED =  2;
+
+type
+  core_server_config = record
+
+    gprof_dir: PChar;
+
+    {* Name translations --- we want the core to be able to do *something*
+     * so it's at least a minimally functional web server on its own (and
+     * can be tested that way).  But let's keep it to the bare minimum:
+     *}
+    ap_document_root: PChar;
+
+    //* Access control */
+
+    access_name: PChar;
+    sec_dir: Papr_array_header_t;
+    sec_url: Papr_array_header_t;
+
+    //* recursion backstopper */
+    redirect_limit,          //* maximum number of internal redirects */
+    subreq_limit: Integer;   //* maximum nesting level of subrequests */
+
+    protocol: PChar;
+    accf_map: Papr_table_t;
+
+    //* array of ap_errorlog_format_item for error log format string */
+    error_log_format: Papr_array_header_t;
+    {*
+     * two arrays of arrays of ap_errorlog_format_item for additional information
+     * logged to the error log once per connection/request
+     *}
+    error_log_conn,
+    error_log_req: Papr_array_header_t;
+
+    //* TRACE control */
+//#define AP_TRACE_UNSET    -1  {fpc -> consts are moved up}
+//#define AP_TRACE_DISABLE   0
+//#define AP_TRACE_ENABLE    1
+//#define AP_TRACE_EXTENDED  2
+    trace_enable: Integer;
+
+  end; {core_server_config}
+
+//* for AddOutputFiltersByType in core.c */
+//void ap_add_output_filters_by_type(request_rec *r);
+
+//* for http_config.c */
+//void ap_core_reorder_directories(apr_pool_t *, server_rec *);
+
+//* for mod_perl */
+//AP_CORE_DECLARE(void) ap_add_per_dir_conf(server_rec *s, void *dir_config);
+//AP_CORE_DECLARE(void) ap_add_per_url_conf(server_rec *s, void *url_config);
+//AP_CORE_DECLARE(void) ap_add_file_conf(apr_pool_t *p, core_dir_config *conf, void *url_config);
+//AP_CORE_DECLARE(const char *) ap_add_if_conf(apr_pool_t *p, core_dir_config *conf, void *url_config);
+//AP_CORE_DECLARE_NONSTD(const char *) ap_limit_section(cmd_parms *cmd, void *dummy, const char *arg);
+
+//* Core filters; not exported. */
+//apr_status_t ap_core_input_filter(ap_filter_t *f, apr_bucket_brigade *b,
+//                                  ap_input_mode_t mode, apr_read_type_e block,
+//                                  apr_off_t readbytes);
+//apr_status_t ap_core_output_filter(ap_filter_t *f, apr_bucket_brigade *b);
+
+
+//AP_DECLARE(const char*) ap_get_server_protocol(server_rec* s);
+//AP_DECLARE(void) ap_set_server_protocol(server_rec* s, const char* proto);
+
+//typedef struct core_output_filter_ctx core_output_filter_ctx_t;
+type
+  Pcore_output_filter_ctx_t = ^core_output_filter_ctx_t;
+  core_output_filter_ctx_t = record end;
+
+//typedef struct core_filter_ctx        core_ctx_t;
+  Pcore_filter_ctx_t = ^core_filter_ctx_t;
+  core_filter_ctx_t = record end;
+  core_ctx_t = core_filter_ctx_t;
+  Pcore_ctx_t = ^core_ctx_t;
+
+  core_net_rec = record
+    //** Connection to the client */
+    client_socket: Papr_socket_t;
+
+    //** connection record */
+    c: Pconn_rec;
+
+    out_ctx: Pcore_output_filter_ctx_t;
+    in_ctx: Pcore_ctx_t;
+  end; {core_net_rec}
+
+{**
+ * Insert the network bucket into the core input filter's input brigade.
+ * This hook is intended for MPMs or protocol modules that need to do special
+ * socket setup.
+ * @param c The connection
+ * @param bb The brigade to insert the bucket into
+ * @param socket The socket to put into a bucket
+ * @return AP_DECLINED if the current function does not handle this connection,
+ *         APR_SUCCESS or an error otherwise.
+ *}
+//AP_DECLARE_HOOK(apr_status_t, insert_network_bucket,
+//                (conn_rec *c, apr_bucket_brigade *bb, apr_socket_t *socket))
+type
+  ap_HOOK_insert_network_bucket_t = function(c: Pconn_rec; bb: Papr_bucket_brigade; socket: Papr_socket_t): apr_status_t; cdecl;
+
+procedure ap_hook_insert_network_bucket(pf: ap_HOOK_insert_network_bucket_t;
+                                 const aszPre: PPChar; const aszSucc: PPChar; nOrder: Integer);
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name LibNamePrefix + 'ap_hook_insert_network_bucket' + LibSuff16;
+
+{* ----------------------------------------------------------------------
+ *
+ * Runtime status/management
+ *}
+
+type
+  ap_mgmt_type_e = (
+    ap_mgmt_type_string,
+    ap_mgmt_type_long,
+    ap_mgmt_type_hash
+  );
+
+  ap_mgmt_value = record
+    case Integer of
+     0: (s_value: PChar);
+     1: (i_value: cLong);
+     2: (h_value: Papr_hash_t);
+  end;
+
+  ap_mgmt_item_t = record
+    description: PChar;
+    name: PChar;
+    vtype: ap_mgmt_type_e;
+    v: ap_mgmt_value;
+  end;
+
+///* Handles for core filters */
+//extern AP_DECLARE_DATA ap_filter_rec_t *ap_subreq_core_filter_handle;
+//extern AP_DECLARE_DATA ap_filter_rec_t *ap_core_output_filter_handle;
+//extern AP_DECLARE_DATA ap_filter_rec_t *ap_content_length_filter_handle;
+//extern AP_DECLARE_DATA ap_filter_rec_t *ap_core_input_filter_handle;
+
+{**
+ * This hook provdes a way for modules to provide metrics/statistics about
+ * their operational status.
+ *
+ * @param p A pool to use to create entries in the hash table
+ * @param val The name of the parameter(s) that is wanted. This is
+ *            tree-structured would be in the form ('*' is all the tree,
+ *            'module.*' all of the module , 'module.foo.*', or
+ *            'module.foo.bar' )
+ * @param ht The hash table to store the results. Keys are item names, and
+ *           the values point to ap_mgmt_item_t structures.
+ * @ingroup hooks
+ *}
+//AP_DECLARE_HOOK(int, get_mgmt_items,
+//                (apr_pool_t *p, const char * val, apr_hash_t *ht))
+type
+  ap_HOOK_get_mgmt_items_t = function(p: Papr_pool_t; const val: PChar; ht: Papr_hash_t): Integer; cdecl;
+
+procedure ap_hook_get_mgmt_items(pf: ap_HOOK_get_mgmt_items_t;
+                                 const aszPre: PPChar; const aszSucc: PPChar; nOrder: Integer);
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name LibNamePrefix + 'ap_hook_get_mgmt_items' + LibSuff16;
+
+//* ---------------------------------------------------------------------- */
+
+{* ----------------------------------------------------------------------
+ *
+ * I/O logging with mod_logio
+ *}
+
+//APR_DECLARE_OPTIONAL_FN(void, ap_logio_add_bytes_out,
+//                        (conn_rec *c, apr_off_t bytes));
+
+//APR_DECLARE_OPTIONAL_FN(void, ap_logio_add_bytes_in,
+//                        (conn_rec *c, apr_off_t bytes));
+
+//APR_DECLARE_OPTIONAL_FN(apr_off_t, ap_logio_get_last_bytes, (conn_rec *c));
+
+{* ----------------------------------------------------------------------
+ *
+ * Error log formats
+ *}
+
+{**
+ * The info structure passed to callback functions of errorlog handlers.
+ * Not all information is available in all contexts. In particular, all
+ * pointers may be NULL.
+ *}
+type
+  Pap_errorlog_info = ^ap_errorlog_info;
+  ap_errorlog_info = record
+    {** current server_rec.
+     *  Should be preferred over c->base_server and r->server
+     *}
+    s: Pserver_rec;
+
+    {** current conn_rec.
+     *  Should be preferred over r->connecction
+     *}
+    c: Pconn_rec;
+
+    //** current request_rec. */
+    r :Prequest_rec;
+    //** r->main if r is a subrequest, otherwise equal to r */
+    rmain :Prequest_rec;
+
+    //** pool passed to ap_log_perror, NULL otherwise */
+    pool: Papr_pool_t;
+
+    //** name of source file where the log message was produced, NULL if N/A. */
+    file_: PChar;
+    //** line number in the source file, 0 if N/A */
+    line: Integer;
+
+    //** module index of module that produced the log message, APLOG_NO_MODULE if N/A. */
+    module_index: Integer;
+    //** log level of error message (flags like APLOG_STARTUP have been removed), -1 if N/A */
+    level: Integer;
+
+    //** apr error status related to the log message, 0 if no error */
+    status: apr_status_t;
+
+    //** 1 if logging to syslog, 0 otherwise */
+    using_syslog: Integer;
+    //** 1 if APLOG_STARTUP was set for the log message, 0 otherwise */
+    startup: Integer;
+
+    //** message format */
+    format: PChar;
+  end; {ap_errorlog_info}
+
+{**
+ * callback function prototype for a external errorlog handler
+ * @note To avoid unbounded memory usage, these functions must not allocate
+ * memory from the server, connection, or request pools. If an errorlog
+ * handler absolutely needs a pool to pass to other functions, it must create
+ * and destroy a sub-pool.
+ *}
+//typedef int ap_errorlog_handler_fn_t(const ap_errorlog_info *info,
+//                                     const char *arg, char *buf, int buflen);
+type
+ap_errorlog_handler_fn_t = function(const info: Pap_errorlog_info;
+                                    const arg: PChar; buf: PChar; buflen: Integer):Integer; cdecl;
+{**
+ * Register external errorlog handler
+ * @param p config pool to use
+ * @param tag the new format specifier (i.e. the letter after the %)
+ * @param handler the handler function
+ * @param flags flags (reserved, set to 0)
+ *}
+//AP_DECLARE(void) ap_register_errorlog_handler(apr_pool_t *p, char *tag,
+//                                              ap_errorlog_handler_fn_t *handler,
+//                                              int flags);
+procedure ap_register_errorlog_handler(p: Papr_pool_t; tag: PChar;
+                                       handler: ap_errorlog_handler_fn_t;
+                                       flags: Integer);
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name LibNamePrefix + 'ap_register_errorlog_handler' + LibSuff16;
+
+type
+  ap_errorlog_handler = record
+      func: ap_errorlog_handler_fn_t;
+      flags: Integer; //* for future extensions */
+  end; {ap_errorlog_handler}
+
+const
+  //** item starts a new field */
+  AP_ERRORLOG_FLAG_FIELD_SEP       = 1;
+  //** item is the actual error message */
+  AP_ERRORLOG_FLAG_MESSAGE         = 2;
+  //** skip whole line if item is zero-length */
+  AP_ERRORLOG_FLAG_REQUIRED        = 4;
+  //** log zero-length item as '-' */
+  AP_ERRORLOG_FLAG_NULL_AS_HYPHEN  = 8;
+
+type
+  ap_errorlog_format_item = record
+    //** ap_errorlog_handler function */
+    func: ap_errorlog_handler_fn_t;
+    //** argument passed to item in {} */
+    arg: PChar;
+    //** a combination of the AP_ERRORLOG_* flags */
+    flags: cuint;
+    //** only log item if the message's log level is higher than this */
+    min_loglevel: cuint;
+  end; {ap_errorlog_format_item}
+
+{**
+ * hook method to log error messages
+ * @ingroup hooks
+ * @param info pointer to ap_errorlog_info struct which contains all
+ *        the details
+ * @param errstr the (unformatted) message to log
+ * @warning Allocating from the usual pools (pool, info->c->pool, info->p->pool)
+ *          must be avoided because it can cause memory leaks.
+ *          Use a subpool if necessary.
+ *}
+//AP_DECLARE_HOOK(void, error_log, (const ap_errorlog_info *info,
+//                                  const char *errstr))
+
+//AP_CORE_DECLARE(void) ap_register_log_hooks(apr_pool_t *p);
+//AP_CORE_DECLARE(void) ap_register_config_hooks(apr_pool_t *p);
+
+{* ----------------------------------------------------------------------
+ *
+ * ident lookups with mod_ident
+ *}
+
+//APR_DECLARE_OPTIONAL_FN(const char *, ap_ident_lookup,
+//                        (request_rec *r));
+
+{* ----------------------------------------------------------------------
+ *
+ * authorization values with mod_authz_core
+ *}
+
+//APR_DECLARE_OPTIONAL_FN(int, authz_some_auth_required, (request_rec *r));
+//APR_DECLARE_OPTIONAL_FN(const char *, authn_ap_auth_type, (request_rec *r));
+//APR_DECLARE_OPTIONAL_FN(const char *, authn_ap_auth_name, (request_rec *r));
+
+{* ----------------------------------------------------------------------
+ *
+ * authorization values with mod_access_compat
+ *}
+
+//APR_DECLARE_OPTIONAL_FN(int, access_compat_ap_satisfies, (request_rec *r));
+
+//* ---------------------------------------------------------------------- */
+
+{** Query the server for some state information
+ * @param query_code Which information is requested
+ * @return the requested state information
+ *}
+//AP_DECLARE(int) ap_state_query(int query_code);
+function ap_state_query(query_code: Integer): Integer;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name LibNamePrefix + 'ap_state_query' + LibSuff4;
+
+{*
+ * possible values for query_code in ap_state_query()
+ *}
+
+const
+  //** current status of the server */
+  AP_SQ_MAIN_STATE        = 0;
+  //** are we going to serve requests or are we just testing/dumping config */
+  AP_SQ_RUN_MODE          = 1;
+  //** generation of the top-level apache parent */
+  AP_SQ_CONFIG_GEN        = 2;
+
+{*
+ * return values for ap_state_query()
+ *}
+
+  //** return value for unknown query_code */
+  AP_SQ_NOT_SUPPORTED        = -1;
+
+//* values returned for AP_SQ_MAIN_STATE */
+  //** before the config preflight */
+  AP_SQ_MS_INITIAL_STARTUP   = 1;
+  //** initial configuration run for setting up log config, etc. */
+  AP_SQ_MS_CREATE_PRE_CONFIG = 2;
+  //** tearing down configuration */
+  AP_SQ_MS_DESTROY_CONFIG    = 3;
+  //** normal configuration run */
+  AP_SQ_MS_CREATE_CONFIG     = 4;
+  //** running the MPM */
+  AP_SQ_MS_RUN_MPM           = 5;
+  //** cleaning up for exit */
+  AP_SQ_MS_EXITING           = 6;
+
+//* values returned for AP_SQ_RUN_MODE */
+  //** command line not yet parsed */
+  AP_SQ_RM_UNKNOWN           = 1;
+  //** normal operation (server requests or signal server) */
+  AP_SQ_RM_NORMAL            = 2;
+  //** config test only */
+  AP_SQ_RM_CONFIG_TEST       = 3;
+  //** only dump some parts of the config */
+  AP_SQ_RM_CONFIG_DUMP       = 4;
+
+//#endif  /* !APACHE_HTTP_CORE_H */
+(** @} *)

+ 743 - 0
packages/httpd24/src/http_log.inc

@@ -0,0 +1,743 @@
+{* 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.
+ *}
+
+(**
+ * @file  http_log.h
+ * @brief Apache Logging library
+ *
+ * @defgroup APACHE_CORE_LOG Logging library
+ * @ingroup  APACHE_CORE
+ * @{
+ *)
+
+//#ifndef APACHE_HTTP_LOG_H
+//#define APACHE_HTTP_LOG_H
+
+//#include "apr_thread_proc.h"
+//#include "http_config.h"
+
+//#ifdef HAVE_SYSLOG
+//#include <syslog.h>
+
+const 
+LOG_PRIMASK	= 7;
+
+APLOG_EMERG	= 0;    //* system is unusable */
+APLOG_ALERT     = 1;    //* action must be taken immediately */
+APLOG_CRIT      = 2;    //* critical conditions */
+APLOG_ERR       = 3;    //* error conditions */
+APLOG_WARNING   = 4;    //* warning conditions */
+APLOG_NOTICE    = 5;    //* normal but significant condition */
+APLOG_INFO      = 6;    //* informational */
+APLOG_DEBUG     = 7;    //* debug-level messages */
+APLOG_TRACE1    = 8;    //* trace-level 1 messages */
+APLOG_TRACE2    = 9;    //* trace-level 2 messages */
+APLOG_TRACE3    =10;    //* trace-level 3 messages */
+APLOG_TRACE4    =11;    //* trace-level 4 messages */
+APLOG_TRACE5    =12;    //* trace-level 5 messages */
+APLOG_TRACE6    =13;    //* trace-level 6 messages */
+APLOG_TRACE7    =14;    //* trace-level 7 messages */
+APLOG_TRACE8    =15;    //* trace-level 8 messages */
+
+APLOG_LEVELMASK =15;    //* mask off the level value */
+
+
+{* APLOG_NOERRNO is ignored and should not be used.  It will be
+ * removed in a future release of Apache.
+ *}
+APLOG_NOERRNO   =       (APLOG_LEVELMASK + 1);
+
+{** Use APLOG_TOCLIENT on ap_log_rerror() to give content
+ * handlers the option of including the error text in the
+ * ErrorDocument sent back to the client. Setting APLOG_TOCLIENT
+ * will cause the error text to be saved in the request_rec->notes
+ * table, keyed to the string "error-notes", if and only if:
+ * - the severity level of the message is APLOG_WARNING or greater
+ * - there are no other "error-notes" set in request_rec->notes
+ * Once error-notes is set, it is up to the content handler to
+ * determine whether this text should be sent back to the client.
+ * Note: Client generated text streams sent back to the client MUST
+ * be escaped to prevent CSS attacks.
+ *}
+APLOG_TOCLIENT	=	((APLOG_LEVELMASK + 1) * 2);
+
+//* normal but significant condition on startup, usually printed to stderr */
+APLOG_STARTUP	=	((APLOG_LEVELMASK + 1) * 4);
+
+DEFAULT_LOGLEVEL	=	APLOG_WARNING;
+
+{**
+ * APLOGNO() should be used at the start of the format string passed
+ * to ap_log_error() and friends. The argument must be a 5 digit decimal
+ * number. It creates a tag of the form "AH02182: "
+ * See docs/log-message-tags/README for details.
+ *}
+//#define APLOGNO(n)              "AH" #n ": "
+{fpc, could be a function ... ignored}
+
+{**
+ * APLOG_NO_MODULE may be passed as module_index to ap_log_error() and related
+ * functions if the module causing the log message is not known. Normally this
+ * should not be used directly. Use ::APLOG_MARK or ::APLOG_MODULE_INDEX
+ * instead.
+ *
+ * @see APLOG_MARK
+ * @see APLOG_MODULE_INDEX
+ * @see ap_log_error
+ *}
+APLOG_NO_MODULE	=	-1;
+{
+#ifdef __cplusplus
+/**
+ * C++ modules must invoke ::APLOG_USE_MODULE or ::AP_DECLARE_MODULE in
+ * every file which uses ap_log_* before the first use of ::APLOG_MARK
+ * or ::APLOG_MODULE_INDEX.
+ * (C modules *should* do that as well, to enable module-specific log
+ * levels. C modules need not obey the ordering, though).
+ */
+#else /* __cplusplus */
+/**
+ * Constant to store module_index for the current file.
+ * Objects with static storage duration are set to NULL if not
+ * initialized explicitly. This means that if aplog_module_index
+ * is not initalized using the ::APLOG_USE_MODULE or the
+ * ::AP_DECLARE_MODULE macro, we can safely fall back to
+ * use ::APLOG_NO_MODULE. This variable will usually be optimized away.
+ */
+static int * const aplog_module_index;
+#endif /* __cplusplus */
+}
+{**
+ * APLOG_MODULE_INDEX contains the module_index of the current module if
+ * it has been set via the ::APLOG_USE_MODULE or ::AP_DECLARE_MODULE macro.
+ * Otherwise it contains ::APLOG_NO_MODULE (for example in unmodified httpd
+ * 2.2 modules).
+ *
+ * If ::APLOG_MARK is used in ap_log_error() and related functions,
+ * ::APLOG_MODULE_INDEX will be passed as module_index. In cases where
+ * ::APLOG_MARK cannot be used, ::APLOG_MODULE_INDEX should normally be passed
+ * as module_index.
+ *
+ * @see APLOG_MARK
+ * @see ap_log_error
+ *}
+(*
+#ifdef __cplusplus
+#define APLOG_MODULE_INDEX ( *aplog_module_index)
+#else /* __cplusplus */
+#define APLOG_MODULE_INDEX  \
+    (aplog_module_index ? *aplog_module_index : APLOG_NO_MODULE)
+#endif /* __cplusplus */
+
+/**
+ * APLOG_MAX_LOGLEVEL can be defined to remove logging above some
+ * specified level at compile time.
+ *
+ * This requires a C99 compiler.
+ */
+#ifdef DOXYGEN
+#define APLOG_MAX_LOGLEVEL
+#endif
+#ifndef APLOG_MAX_LOGLEVEL
+#define APLOG_MODULE_IS_LEVEL(s,module_index,level)              \
+          ( (((level)&APLOG_LEVELMASK) <= APLOG_NOTICE) ||       \
+            (s == NULL) ||                                       \
+            (ap_get_server_module_loglevel(s, module_index)      \
+             >= ((level)&APLOG_LEVELMASK) ) )
+#define APLOG_C_MODULE_IS_LEVEL(c,module_index,level)            \
+          ( (((level)&APLOG_LEVELMASK) <= APLOG_NOTICE) ||       \
+            (ap_get_conn_module_loglevel(c, module_index)        \
+             >= ((level)&APLOG_LEVELMASK) ) )
+#define APLOG_CS_MODULE_IS_LEVEL(c,s,module_index,level)            \
+          ( (((level)&APLOG_LEVELMASK) <= APLOG_NOTICE) ||          \
+            (ap_get_conn_server_module_loglevel(c, s, module_index) \
+             >= ((level)&APLOG_LEVELMASK) ) )
+#define APLOG_R_MODULE_IS_LEVEL(r,module_index,level)            \
+          ( (((level)&APLOG_LEVELMASK) <= APLOG_NOTICE) ||       \
+            (ap_get_request_module_loglevel(r, module_index)     \
+             >= ((level)&APLOG_LEVELMASK) ) )
+#else
+#define APLOG_MODULE_IS_LEVEL(s,module_index,level)              \
+        ( (((level)&APLOG_LEVELMASK) <= APLOG_MAX_LOGLEVEL) &&   \
+          ( (((level)&APLOG_LEVELMASK) <= APLOG_NOTICE) ||       \
+            (s == NULL) ||                                       \
+            (ap_get_server_module_loglevel(s, module_index)      \
+             >= ((level)&APLOG_LEVELMASK) ) ) )
+#define APLOG_CS_MODULE_IS_LEVEL(c,s,module_index,level)            \
+        ( (((level)&APLOG_LEVELMASK) <= APLOG_MAX_LOGLEVEL) &&      \
+          ( (((level)&APLOG_LEVELMASK) <= APLOG_NOTICE) ||          \
+            (ap_get_conn_server_module_loglevel(c, s, module_index) \
+             >= ((level)&APLOG_LEVELMASK) ) ) )
+#define APLOG_C_MODULE_IS_LEVEL(c,module_index,level)            \
+        ( (((level)&APLOG_LEVELMASK) <= APLOG_MAX_LOGLEVEL) &&   \
+          ( (((level)&APLOG_LEVELMASK) <= APLOG_NOTICE) ||       \
+            (ap_get_conn_module_loglevel(c, module_index)        \
+             >= ((level)&APLOG_LEVELMASK) ) ) )
+#define APLOG_R_MODULE_IS_LEVEL(r,module_index,level)            \
+        ( (((level)&APLOG_LEVELMASK) <= APLOG_MAX_LOGLEVEL) &&   \
+          ( (((level)&APLOG_LEVELMASK) <= APLOG_NOTICE) ||       \
+            (ap_get_request_module_loglevel(r, module_index)     \
+             >= ((level)&APLOG_LEVELMASK) ) ) )
+#endif
+
+#define APLOG_IS_LEVEL(s,level)     \
+    APLOG_MODULE_IS_LEVEL(s,APLOG_MODULE_INDEX,level)
+#define APLOG_C_IS_LEVEL(c,level)   \
+    APLOG_C_MODULE_IS_LEVEL(c,APLOG_MODULE_INDEX,level)
+#define APLOG_CS_IS_LEVEL(c,s,level) \
+    APLOG_CS_MODULE_IS_LEVEL(c,s,APLOG_MODULE_INDEX,level)
+#define APLOG_R_IS_LEVEL(r,level)   \
+    APLOG_R_MODULE_IS_LEVEL(r,APLOG_MODULE_INDEX,level)
+
+
+#define APLOGinfo(s)                APLOG_IS_LEVEL(s,APLOG_INFO)
+#define APLOGdebug(s)               APLOG_IS_LEVEL(s,APLOG_DEBUG)
+#define APLOGtrace1(s)              APLOG_IS_LEVEL(s,APLOG_TRACE1)
+#define APLOGtrace2(s)              APLOG_IS_LEVEL(s,APLOG_TRACE2)
+#define APLOGtrace3(s)              APLOG_IS_LEVEL(s,APLOG_TRACE3)
+#define APLOGtrace4(s)              APLOG_IS_LEVEL(s,APLOG_TRACE4)
+#define APLOGtrace5(s)              APLOG_IS_LEVEL(s,APLOG_TRACE5)
+#define APLOGtrace6(s)              APLOG_IS_LEVEL(s,APLOG_TRACE6)
+#define APLOGtrace7(s)              APLOG_IS_LEVEL(s,APLOG_TRACE7)
+#define APLOGtrace8(s)              APLOG_IS_LEVEL(s,APLOG_TRACE8)
+
+#define APLOGrinfo(r)               APLOG_R_IS_LEVEL(r,APLOG_INFO)
+#define APLOGrdebug(r)              APLOG_R_IS_LEVEL(r,APLOG_DEBUG)
+#define APLOGrtrace1(r)             APLOG_R_IS_LEVEL(r,APLOG_TRACE1)
+#define APLOGrtrace2(r)             APLOG_R_IS_LEVEL(r,APLOG_TRACE2)
+#define APLOGrtrace3(r)             APLOG_R_IS_LEVEL(r,APLOG_TRACE3)
+#define APLOGrtrace4(r)             APLOG_R_IS_LEVEL(r,APLOG_TRACE4)
+#define APLOGrtrace5(r)             APLOG_R_IS_LEVEL(r,APLOG_TRACE5)
+#define APLOGrtrace6(r)             APLOG_R_IS_LEVEL(r,APLOG_TRACE6)
+#define APLOGrtrace7(r)             APLOG_R_IS_LEVEL(r,APLOG_TRACE7)
+#define APLOGrtrace8(r)             APLOG_R_IS_LEVEL(r,APLOG_TRACE8)
+
+#define APLOGcinfo(c)               APLOG_C_IS_LEVEL(c,APLOG_INFO)
+#define APLOGcdebug(c)              APLOG_C_IS_LEVEL(c,APLOG_DEBUG)
+#define APLOGctrace1(c)             APLOG_C_IS_LEVEL(c,APLOG_TRACE1)
+#define APLOGctrace2(c)             APLOG_C_IS_LEVEL(c,APLOG_TRACE2)
+#define APLOGctrace3(c)             APLOG_C_IS_LEVEL(c,APLOG_TRACE3)
+#define APLOGctrace4(c)             APLOG_C_IS_LEVEL(c,APLOG_TRACE4)
+#define APLOGctrace5(c)             APLOG_C_IS_LEVEL(c,APLOG_TRACE5)
+#define APLOGctrace6(c)             APLOG_C_IS_LEVEL(c,APLOG_TRACE6)
+#define APLOGctrace7(c)             APLOG_C_IS_LEVEL(c,APLOG_TRACE7)
+#define APLOGctrace8(c)             APLOG_C_IS_LEVEL(c,APLOG_TRACE8)
+
+extern int AP_DECLARE_DATA ap_default_loglevel;
+
+/**
+ * APLOG_MARK is a convenience macro for use as the first three parameters in
+ * ap_log_error() and related functions, i.e. file, line, and module_index.
+ *
+ * The module_index parameter was introduced in version 2.3.6. Before that
+ * version, APLOG_MARK only replaced the file and line parameters.
+ * This means that APLOG_MARK can be used with ap_log_*error in all versions
+ * of Apache httpd.
+ *
+ * @see APLOG_MODULE_INDEX
+ * @see ap_log_error
+ * @see ap_log_cerror
+ * @see ap_log_rerror
+ * @see ap_log_cserror
+ */
+#define APLOG_MARK     __FILE__,__LINE__,APLOG_MODULE_INDEX
+*)
+{**
+ * Set up for logging to stderr.
+ * @param p The pool to allocate out of
+ *}
+procedure ap_open_stderr_log(p: Papr_pool_t);
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name LibNamePrefix + 'ap_open_stderr_log' + LibSuff4;
+
+{**
+ * Replace logging to stderr with logging to the given file.
+ * @param p The pool to allocate out of
+ * @param file Name of the file to log stderr output
+ *}
+function ap_replace_stderr_log(p: Papr_pool_t; file_: PChar): apr_status_t;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name LibNamePrefix + 'ap_replace_stderr_log' + LibSuff8;
+
+{**
+ * Open the error log and replace stderr with it.
+ * @param pconf Not used
+ * @param plog  The pool to allocate the logs from
+ * @param ptemp Pool used for temporary allocations
+ * @param s_main The main server
+ * @note ap_open_logs isn't expected to be used by modules, it is
+ * an internal core function
+ *}
+//int ap_open_logs(apr_pool_t *pconf, apr_pool_t *plog,
+//                 apr_pool_t *ptemp, server_rec *s_main);
+
+{**
+ * Perform special processing for piped loggers in MPM child
+ * processes.
+ * @param p Not used
+ * @param s Not used
+ * @note ap_logs_child_init is not for use by modules; it is an
+ * internal core function
+ *}
+//void ap_logs_child_init(apr_pool_t *p, server_rec *s);
+
+{*
+ * The primary logging functions, ap_log_error, ap_log_rerror, ap_log_cerror,
+ * and ap_log_perror use a printf style format string to build the log message.
+ * It is VERY IMPORTANT that you not include any raw data from the network,
+ * such as the request-URI or request header fields, within the format
+ * string.  Doing so makes the server vulnerable to a denial-of-service
+ * attack and other messy behavior.  Instead, use a simple format string
+ * like "%s", followed by the string containing the untrusted data.
+ *}
+
+{**
+ * ap_log_error() - log messages which are not related to a particular
+ * request or connection.  This uses a printf-like format to log messages
+ * to the error_log.
+ * @param file The file in which this function is called
+ * @param line The line number on which this function is called
+ * @param module_index The module_index of the module generating this message
+ * @param level The level of this error message
+ * @param status The status code from the previous command
+ * @param s The server on which we are logging
+ * @param fmt The format string
+ * @param ... The arguments to use to fill out fmt.
+ * @note ap_log_error is implemented as a macro
+ * @note Use APLOG_MARK to fill out file and line
+ * @note If a request_rec is available, use that with ap_log_rerror()
+ * in preference to calling this function.  Otherwise, if a conn_rec is
+ * available, use that with ap_log_cerror() in preference to calling
+ * this function.
+ * @warning It is VERY IMPORTANT that you not include any raw data from
+ * the network, such as the request-URI or request header fields, within
+ * the format string.  Doing so makes the server vulnerable to a
+ * denial-of-service attack and other messy behavior.  Instead, use a
+ * simple format string like "%s", followed by the string containing the
+ * untrusted data.
+ *}
+(*#ifdef DOXYGEN
+AP_DECLARE(void) ap_log_error(const char *file, int line, int module_index,
+                              int level, apr_status_t status,
+                              const server_rec *s, const char *fmt, ...);
+#else
+#ifdef AP_HAVE_C99
+/* need additional step to expand APLOG_MARK first */
+#define ap_log_error(...) ap_log_error__(__VA_ARGS__)
+/* need server_rec *sr = ... for the case if s is verbatim NULL */
+#define ap_log_error__(file, line, mi, level, status, s, ...)           \
+    do { const server_rec *sr__ = s; if (APLOG_MODULE_IS_LEVEL(sr__, mi, level)) \
+             ap_log_error_(file, line, mi, level, status, sr__, __VA_ARGS__);    \
+    } while(0)
+#else
+#define ap_log_error ap_log_error_
+#endif
+AP_DECLARE(void) ap_log_error_(const char *file, int line, int module_index,
+                               int level, apr_status_t status,
+                               const server_rec *s, const char *fmt, ...)
+                              __attribute__((format(printf,7,8)));
+#endif
+*)
+procedure ap_log_error(const file_: PChar;
+                       line,
+                       module_index,        //extra parameter from Apache 2.3.x
+                       level: Integer;
+                       status: apr_status_t;
+                       const s: Pserver_rec;
+                       const fmt: PChar;
+                       fmt_args: array of const); cdecl;
+  external LibHTTPD name 'ap_log_error' + LibSuff_;
+
+{**
+ * ap_log_perror() - log messages which are not related to a particular
+ * request, connection, or virtual server.  This uses a printf-like
+ * format to log messages to the error_log.
+ * @param file The file in which this function is called
+ * @param line The line number on which this function is called
+ * @param module_index ignored dummy value for use by APLOG_MARK
+ * @param level The level of this error message
+ * @param status The status code from the previous command
+ * @param p The pool which we are logging for
+ * @param fmt The format string
+ * @param ... The arguments to use to fill out fmt.
+ * @note ap_log_perror is implemented as a macro
+ * @note Use APLOG_MARK to fill out file, line, and module_index
+ * @warning It is VERY IMPORTANT that you not include any raw data from
+ * the network, such as the request-URI or request header fields, within
+ * the format string.  Doing so makes the server vulnerable to a
+ * denial-of-service attack and other messy behavior.  Instead, use a
+ * simple format string like "%s", followed by the string containing the
+ * untrusted data.
+ *}
+(*#ifdef DOXYGEN
+AP_DECLARE(void) ap_log_perror(const char *file, int line, int module_index,
+                               int level, apr_status_t status, apr_pool_t *p,
+                               const char *fmt, ...);
+#else
+#if defined(AP_HAVE_C99) && defined(APLOG_MAX_LOGLEVEL)
+/* need additional step to expand APLOG_MARK first */
+#define ap_log_perror(...) ap_log_perror__(__VA_ARGS__)
+#define ap_log_perror__(file, line, mi, level, status, p, ...)            \
+    do { if ((level) <= APLOG_MAX_LOGLEVEL )                              \
+             ap_log_perror_(file, line, mi, level, status, p,             \
+                            __VA_ARGS__); } while(0)
+#else
+#define ap_log_perror ap_log_perror_
+#endif
+AP_DECLARE(void) ap_log_perror_(const char *file, int line, int module_index,
+                                int level, apr_status_t status, apr_pool_t *p,
+                                const char *fmt, ...)
+                               __attribute__((format(printf,7,8)));
+#endif
+*)
+procedure ap_log_perror(const file_: PChar; line, module_index, level: Integer;
+                        status: apr_status_t; p: Papr_pool_t;
+                        const fmt: PChar; fmt_args: array of const);
+   {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+   external LibHTTPD name 'ap_log_perror' + LibSuff_;
+
+{**
+ * ap_log_rerror() - log messages which are related to a particular
+ * request.  This uses a printf-like format to log messages to the
+ * error_log.
+ * @param file The file in which this function is called
+ * @param line The line number on which this function is called
+ * @param module_index The module_index of the module generating this message
+ * @param level The level of this error message
+ * @param status The status code from the previous command
+ * @param r The request which we are logging for
+ * @param fmt The format string
+ * @param ... The arguments to use to fill out fmt.
+ * @note ap_log_rerror is implemented as a macro
+ * @note Use APLOG_MARK to fill out file, line, and module_index
+ * @warning It is VERY IMPORTANT that you not include any raw data from
+ * the network, such as the request-URI or request header fields, within
+ * the format string.  Doing so makes the server vulnerable to a
+ * denial-of-service attack and other messy behavior.  Instead, use a
+ * simple format string like "%s", followed by the string containing the
+ * untrusted data.
+ *}
+(*#ifdef DOXYGEN
+AP_DECLARE(void) ap_log_rerror(const char *file, int line, int module_index,
+                               int level, apr_status_t status,
+                               const request_rec *r, const char *fmt, ...);
+#else
+#ifdef AP_HAVE_C99
+/* need additional step to expand APLOG_MARK first */
+#define ap_log_rerror(...) ap_log_rerror__(__VA_ARGS__)
+#define ap_log_rerror__(file, line, mi, level, status, r, ...)              \
+    do { if (APLOG_R_MODULE_IS_LEVEL(r, mi, level))                         \
+             ap_log_rerror_(file, line, mi, level, status, r, __VA_ARGS__); \
+    } while(0)
+#else
+#define ap_log_rerror ap_log_rerror_
+#endif
+AP_DECLARE(void) ap_log_rerror_(const char *file, int line, int module_index,
+                                int level, apr_status_t status,
+                                const request_rec *r, const char *fmt, ...)
+                                __attribute__((format(printf,7,8)));
+#endif
+*)
+procedure ap_log_rerror(const file_: PChar; line, module_index, level: Integer;
+                        status: apr_status_t; const r: Prequest_rec;
+                        const fmt: PChar; fmt_args: array of const);
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name 'ap_log_rerror_' + LibSuff_;
+
+{**
+ * ap_log_cerror() - log messages which are related to a particular
+ * connection.  This uses a printf-like format to log messages to the
+ * error_log.
+ * @param file The file in which this function is called
+ * @param line The line number on which this function is called
+ * @param level The level of this error message
+ * @param module_index The module_index of the module generating this message
+ * @param status The status code from the previous command
+ * @param c The connection which we are logging for
+ * @param fmt The format string
+ * @param ... The arguments to use to fill out fmt.
+ * @note ap_log_cerror is implemented as a macro
+ * @note Use APLOG_MARK to fill out file, line, and module_index
+ * @note If a request_rec is available, use that with ap_log_rerror()
+ * in preference to calling this function.
+ * @warning It is VERY IMPORTANT that you not include any raw data from
+ * the network, such as the request-URI or request header fields, within
+ * the format string.  Doing so makes the server vulnerable to a
+ * denial-of-service attack and other messy behavior.  Instead, use a
+ * simple format string like "%s", followed by the string containing the
+ * untrusted data.
+ *}
+(*#ifdef DOXYGEN
+AP_DECLARE(void) ap_log_cerror(const char *file, int line, int module_index,
+                               int level, apr_status_t status,
+                               const conn_rec *c, const char *fmt, ...);
+#else
+#ifdef AP_HAVE_C99
+/* need additional step to expand APLOG_MARK first */
+#define ap_log_cerror(...) ap_log_cerror__(__VA_ARGS__)
+#define ap_log_cerror__(file, line, mi, level, status, c, ...)              \
+    do { if (APLOG_C_MODULE_IS_LEVEL(c, mi, level))                         \
+             ap_log_cerror_(file, line, mi, level, status, c, __VA_ARGS__); \
+    } while(0)
+#else
+#define ap_log_cerror ap_log_cerror_
+#endif
+AP_DECLARE(void) ap_log_cerror_(const char *file, int line, int module_index,
+                                int level, apr_status_t status,
+                                const conn_rec *c, const char *fmt, ...)
+                                __attribute__((format(printf,7,8)));
+#endif
+*)
+procedure ap_log_cerror(const file_: PChar; line, module_index, level: Integer;
+                        status: apr_status_t; const c: Pconn_rec;
+                        const fmt: PChar; fmt_args: array of const);
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name 'ap_log_cerror' + LibSuff_;
+
+{**
+ * ap_log_cserror() - log messages which are related to a particular
+ * connection and to a vhost other than c->base_server.  This uses a
+ * printf-like format to log messages to the error_log.
+ * @param file The file in which this function is called
+ * @param line The line number on which this function is called
+ * @param level The level of this error message
+ * @param module_index The module_index of the module generating this message
+ * @param status The status code from the previous command
+ * @param c The connection which we are logging for
+ * @param s The server which we are logging for
+ * @param fmt The format string
+ * @param ... The arguments to use to fill out fmt.
+ * @note ap_log_cserror is implemented as a macro
+ * @note Use APLOG_MARK to fill out file, line, and module_index
+ * @note If a request_rec is available, use that with ap_log_rerror()
+ * in preference to calling this function. This function is mainly useful for
+ * modules like mod_ssl to use before the request_rec is created.
+ * @warning It is VERY IMPORTANT that you not include any raw data from
+ * the network, such as the request-URI or request header fields, within
+ * the format string.  Doing so makes the server vulnerable to a
+ * denial-of-service attack and other messy behavior.  Instead, use a
+ * simple format string like "%s", followed by the string containing the
+ * untrusted data.
+ *}
+(*#ifdef DOXYGEN
+AP_DECLARE(void) ap_log_cserror(const char *file, int line, int module_index,
+                                int level, apr_status_t status,
+                                const conn_rec *c, const server_rec *s,
+                                const char *fmt, ...);
+#else
+#ifdef AP_HAVE_C99
+/* need additional step to expand APLOG_MARK first */
+#define ap_log_cserror(...) ap_log_cserror__(__VA_ARGS__)
+#define ap_log_cserror__(file, line, mi, level, status, c, s, ...)  \
+    do { if (APLOG_CS_MODULE_IS_LEVEL(c, s, mi, level))             \
+             ap_log_cserror_(file, line, mi, level, status, c, s,   \
+                             __VA_ARGS__);                          \
+    } while(0)
+#else
+#define ap_log_cserror ap_log_cserror_
+#endif
+AP_DECLARE(void) ap_log_cserror_(const char *file, int line, int module_index,
+                                 int level, apr_status_t status,
+                                 const conn_rec *c, const server_rec *s,
+                                 const char *fmt, ...)
+                             __attribute__((format(printf,8,9)));
+#endif
+*)
+procedure ap_log_cserror(const file_: PChar; line, module_index, level: Integer;
+                         status: apr_status_t; const c: Pconn_rec;
+                         const s: Pserver_rec; const fmt: PChar; fmt_args: array of const);
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name 'ap_log_cserror' + LibSuff_;
+
+{**
+ * Convert stderr to the error log
+ * @param s The current server
+ *}
+//AP_DECLARE(void) ap_error_log2stderr(server_rec *s);
+procedure ap_error_log2stderr(s: Pserver_rec);
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name LibNamePrefix + 'ap_error_log2stderr' + LibSuff4;
+
+{**
+ * Log the command line used to start the server.
+ * @param p The pool to use for logging
+ * @param s The server_rec whose process's command line we want to log.
+ * The command line is logged to that server's error log.
+ *}
+//AP_DECLARE(void) ap_log_command_line(apr_pool_t *p, server_rec *s);
+procedure ap_log_command_line(p: Papr_pool_t; s: Pserver_rec);
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name LibNamePrefix + 'ap_log_command_line' + LibSuff8;
+
+{**
+ * Log the current pid of the parent process
+ * @param p The pool to use for processing
+ * @param fname The name of the file to log to.  If the filename is not
+ * absolute then it is assumed to be relative to ServerRoot.
+ *}
+//AP_DECLARE(void) ap_log_pid(apr_pool_t *p, const char *fname);
+procedure ap_log_pid(p: Papr_pool_t; const fname: PChar);
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name LibNamePrefix + 'ap_log_pid' + LibSuff8;
+
+{**
+ * Remove the pidfile.
+ * @param p The pool to use for processing
+ * @param fname The name of the pid file to remove.  If the filename is not
+ * absolute then it is assumed to be relative to ServerRoot.
+ *}
+//AP_DECLARE(void) ap_remove_pid(apr_pool_t *p, const char *fname);
+procedure ap_remove_pid(p: Papr_pool_t; const fname: PChar);
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name LibNamePrefix + 'ap_remove_pid' + LibSuff8;
+
+{**
+ * Retrieve the pid from a pidfile.
+ * @param p The pool to use for processing
+ * @param filename The name of the file containing the pid.  If the filename is not
+ * absolute then it is assumed to be relative to ServerRoot.
+ * @param mypid Pointer to pid_t (valid only if return APR_SUCCESS)
+ *}
+//AP_DECLARE(apr_status_t) ap_read_pid(apr_pool_t *p, const char *filename, pid_t *mypid);
+function ap_read_pid(p: Papr_pool_t; const filename: PChar; mypid: Ppid_t): apr_status_t;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name LibNamePrefix + 'ap_read_pid' + LibSuff12;
+
+{** @see piped_log *}
+//typedef struct piped_log piped_log;
+{fpc -> need the real definition here because it is not in header files}
+{from httpd-2.4.X/server/log.c}
+  {**
+   * @brief The piped logging structure.
+   *
+   * Piped logs are used to move functionality out of the main server.
+   * For example, log rotation is done with piped logs.
+   *}
+type
+  piped_log = record
+      //** The pool to use for the piped log */
+      p: Papr_pool_t;
+      //** The pipe between the server and the logging process */
+      read_fd, write_fd: Papr_file_t;
+  {$ifdef AP_HAVE_RELIABLE_PIPED_LOGS}
+      //** The name of the program the logging process is running */
+      program_: PChar;
+      //** The pid of the logging process */
+      pid: Papr_proc_t;
+      //** How to reinvoke program when it must be replaced */
+      cmdtype: apr_cmdtype_e;
+  {$endif}
+  end;
+  Ppiped_log = ^piped_log;
+
+{**
+ * Open the piped log process
+ * @param p The pool to allocate out of
+ * @param program The program to run in the logging process
+ * @return The piped log structure
+ * @note The log program is invoked as @p APR_PROGRAM_ENV,
+ *      @see ap_open_piped_log_ex to modify this behavior
+ *}
+//AP_DECLARE(piped_log *) ap_open_piped_log(apr_pool_t *p, const char *program);
+function ap_open_piped_log(p: Papr_pool_t; const program_: PChar): Ppiped_log;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name LibNamePrefix + 'ap_open_piped_log' + LibSuff8;
+
+{**
+ * Open the piped log process specifying the execution choice for program
+ * @param p The pool to allocate out of
+ * @param program The program to run in the logging process
+ * @param cmdtype How to invoke program, e.g. APR_PROGRAM, APR_SHELLCMD_ENV, etc
+ * @return The piped log structure
+ *}
+//AP_DECLARE(piped_log *) ap_open_piped_log_ex(apr_pool_t *p,
+//                                             const char *program,
+//                                             apr_cmdtype_e cmdtype);
+function ap_open_piped_log_ex(p: Papr_pool_t;
+                              const program_: PChar;
+                              cmdtype: apr_cmdtype_e): Ppiped_log;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name LibNamePrefix + 'ap_open_piped_log_ex' + LibSuff12;
+
+{**
+ * Close the piped log and kill the logging process
+ * @param pl The piped log structure
+ *}
+//AP_DECLARE(void) ap_close_piped_log(piped_log *pl);
+procedure ap_close_piped_log(pl: Ppiped_log);
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name LibNamePrefix + 'ap_close_piped_log' + LibSuff4;
+
+{**
+ * A function to return the read side of the piped log pipe
+ * @param pl The piped log structure
+ * @return The native file descriptor
+ *}
+//AP_DECLARE(apr_file_t *) ap_piped_log_read_fd(piped_log *pl);
+procedure ap_piped_log_read_fd(pl: Ppiped_log);
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name LibNamePrefix + 'ap_piped_log_read_fd' + LibSuff4;
+
+{**
+ * A function to return the write side of the piped log pipe
+ * @param pl The piped log structure
+ * @return The native file descriptor
+ *}
+//AP_DECLARE(apr_file_t *) ap_piped_log_write_fd(piped_log *pl);
+procedure ap_piped_log_write_fd(pl: Ppiped_log);
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name LibNamePrefix + 'ap_piped_log_write_fd' + LibSuff4;
+
+{**
+ * hook method to generate unique id for connection or request
+ * @ingroup hooks
+ * @param c the conn_rec of the connections
+ * @param r the request_req (may be NULL)
+ * @param id the place where to store the unique id
+ * @return OK or DECLINE
+ *}
+//AP_DECLARE_HOOK(int, generate_log_id,
+//                (const conn_rec *c, const request_rec *r, const char **id))
+(*macro expanded:
+  int ap_HOOK_generate_log_id_t (const conn_rec *c, const request_rec *r, const char **id);
+
+  void ap_hook_generate_log_id(ap_HOOK_generate_log_id_t *pf, const char * const *aszPre, const char * const *aszSucc, int nOrder);
+  int ap_run_generate_log_id (const conn_rec *c, const request_rec *r, const char **id);
+  apr_array_header_t * ap_hook_get_generate_log_id(void);
+
+  typedef struct ap_LINK_generate_log_id_t { ap_HOOK_generate_log_id_t *pFunc; const char *szName; const char * const *aszPredecessors; const char * const *aszSuccessors; int nOrder; } ap_LINK_generate_log_id_t;
+*)
+type
+  ap_HOOK_generate_log_id_t = function(const c: Pconn_rec;
+                                       const r: Prequest_rec;
+                                       const id: PPChar): Longint; cdecl;
+
+  procedure ap_hook_generate_log_id(pf: ap_hook_generate_log_id_t; const aszPre: PPChar; const aszSucc: PPChar; nOrder: Longint);
+    {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+    external LibHTTPD name LibNamePrefix + 'ap_hook_generate_log_id' + LibSuff16;
+
+  function ap_run_generate_log_id(const c: Pconn_rec; const r: Prequest_rec; const id: PPChar): Longint;
+    {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+    external LibHTTPD name LibNamePrefix + 'ap_run_generate_log_id' + LibSuff12;
+
+  function ap_hook_get_generate_log_id: Papr_array_header_t;
+    {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+    external LibHTTPD name LibNamePrefix + 'ap_hook_get_generate_log_id' + LibSuff0;
+
+  {rest of macro ignored}
+
+//#endif  /* !APACHE_HTTP_LOG_H */
+(** @} *)

+ 1088 - 0
packages/httpd24/src/http_protocol.inc

@@ -0,0 +1,1088 @@
+{* 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.
+ *}
+
+(**
+ * @file  http_protocol.h
+ * @brief HTTP protocol handling
+ *
+ * @defgroup APACHE_CORE_PROTO HTTP Protocol Handling
+ * @ingroup  APACHE_CORE
+ * @{
+ *)
+
+//#ifndef APACHE_HTTP_PROTOCOL_H
+//#define APACHE_HTTP_PROTOCOL_H
+
+//#include "httpd.h"
+//#include "apr_portable.h"
+//#include "apr_mmap.h"
+//#include "apr_buckets.h"
+//#include "util_filter.h"
+
+{**
+ * This hook allows modules to insert filters for the current error response
+ * @param r the current request
+ * @ingroup hooks
+ *}
+//AP_DECLARE_HOOK(void,insert_error_filter,(request_rec *r))
+(*macro expanded:
+typedef
+  void ap_HOOK_insert_error_filter_t (request_rec *r);
+
+  void ap_hook_insert_error_filter(ap_HOOK_insert_error_filter_t *pf,
+                                   const char * const *aszPre,
+                                   const char * const *aszSucc,
+                                   int nOrder);
+  void ap_run_insert_error_filter (request_rec *r);
+  apr_array_header_t * ap_hook_get_insert_error_filter(void);
+
+  typedef struct ap_LINK_insert_error_filter_t { ap_HOOK_insert_error_filter_t *pFunc; const char *szName; const char * const *aszPredecessors; const char * const *aszSuccessors; int nOrder; } ap_LINK_insert_error_filter_t;
+*)
+type
+  ap_HOOK_insert_error_filter_t = procedure(r: Prequest_rec); cdecl;
+
+procedure ap_hook_insert_error_filter(pf: ap_HOOK_insert_error_filter_t;
+                                      const aszPre, aszSucc: PPChar;
+                                      nOrder: Integer);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_hook_insert_error_filter' + LibSuff16;
+
+procedure ap_run_insert_error_filter(r: Prequest_rec);
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name LibNamePrefix + 'ap_run_insert_error_filter' + LibSuff4;
+
+function ap_hook_get_insert_error_filter: Papr_array_header_t;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name LibNamePrefix + 'ap_hook_get_insert_error_filter' + LibSuff0;
+
+{rest of macro ignored}
+
+{** This is an optimization.  We keep a record of the filter_rec that
+ * stores the old_write filter, so that we can avoid strcmp's later.
+ *}
+//AP_DECLARE_DATA extern ap_filter_rec_t *ap_old_write_func;
+
+{*
+ * Prototypes for routines which either talk directly back to the user,
+ * or control the ones that eventually do.
+ *}
+
+{**
+ * Read a request and fill in the fields.
+ * @param c The current connection
+ * @return The new request_rec
+ *}
+//request_rec *ap_read_request(conn_rec *c);
+
+{**
+ * Read the mime-encoded headers.
+ * @param r The current request
+ *}
+//AP_DECLARE(void) ap_get_mime_headers(request_rec *r);
+procedure ap_get_mime_headers(r: Prequest_rec);
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name LibNamePrefix + 'ap_get_mime_headers' + LibSuff4;
+
+{**
+ * Optimized version of ap_get_mime_headers() that requires a
+ * temporary brigade to work with
+ * @param r The current request
+ * @param bb temp brigade
+ *}
+//AP_DECLARE(void) ap_get_mime_headers_core(request_rec *r,
+//                                          apr_bucket_brigade *bb);
+procedure ap_get_mime_headers_core(r: Prequest_rec; bb: Papr_bucket_brigade);
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name LibNamePrefix + 'ap_get_mime_headers_core' + LibSuff8;
+
+//* Finish up stuff after a request */
+
+{**
+ * Called at completion of sending the response.  It sends the terminating
+ * protocol information.
+ * @param r The current request
+ *}
+//AP_DECLARE(void) ap_finalize_request_protocol(request_rec *r);
+procedure ap_finalize_request_protocol(r: Prequest_rec);
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name LibNamePrefix + 'ap_finalize_request_protocol' + LibSuff4;
+
+{**
+ * Send error back to client.
+ * @param r The current request
+ * @param recursive_error last arg indicates error status in case we get
+ *      an error in the process of trying to deal with an ErrorDocument
+ *      to handle some other error.  In that case, we print the default
+ *      report for the first thing that went wrong, and more briefly report
+ *      on the problem with the ErrorDocument.
+ *}
+//AP_DECLARE(void) ap_send_error_response(request_rec *r, int recursive_error);
+procedure ap_send_error_response(r: Prequest_rec; recursive_error: Integer);
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name LibNamePrefix + 'ap_send_error_response' + LibSuff8;
+
+{* Set last modified header line from the lastmod date of the associated file.
+ * Also, set content length.
+ *
+ * May return an error status, typically HTTP_NOT_MODIFIED (that when the
+ * permit_cache argument is set to one).
+ *}
+
+{**
+ * Set the content length for this request
+ * @param r The current request
+ * @param length The new content length
+ *}
+//AP_DECLARE(void) ap_set_content_length(request_rec *r, apr_off_t length);
+procedure ap_set_content_length(r: Prequest_rec; length: apr_off_t);
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name LibNamePrefix + 'ap_set_content_length' + LibSuff12;
+
+{**
+ * Set the keepalive status for this request
+ * @param r The current request
+ * @return 1 if keepalive can be set, 0 otherwise
+ *}
+//AP_DECLARE(int) ap_set_keepalive(request_rec *r);
+function ap_set_keepalive(r: Prequest_rec): Integer;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name LibNamePrefix + 'ap_set_keepalive' + LibSuff4;
+
+{**
+ * Return the latest rational time from a request/mtime pair.  Mtime is
+ * returned unless it's in the future, in which case we return the current time.
+ * @param r The current request
+ * @param mtime The last modified time
+ * @return the latest rational time.
+ *}
+//AP_DECLARE(apr_time_t) ap_rationalize_mtime(request_rec *r, apr_time_t mtime);
+function ap_rationalize_mtime(r: Prequest_rec; mtime: apr_time_t): apr_time_t;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name LibNamePrefix + 'ap_rationalize_mtime' + LibSuff12;
+
+{**
+ * Build the content-type that should be sent to the client from the
+ * content-type specified.  The following rules are followed:
+ *    - if type is NULL or "", return NULL (do not set content-type).
+ *    - if charset adding is disabled, stop processing and return type.
+ *    - then, if there are no parameters on type, add the default charset
+ *    - return type
+ * @param r The current request
+ * @param type The content type
+ * @return The content-type
+ *}
+//AP_DECLARE(const char *) ap_make_content_type(request_rec *r,
+//                                              const char *type);
+function ap_make_content_type(r: Prequest_rec; type_: PChar): PChar;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name LibNamePrefix + 'ap_make_content_type' + LibSuff8;
+
+{**
+ * Precompile metadata structures used by ap_make_content_type()
+ * @param pool The pool to use for allocations
+ *}
+//AP_DECLARE(void) ap_setup_make_content_type(apr_pool_t *pool);
+procedure ap_setup_make_content_type(pool: Papr_pool_t);
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name LibNamePrefix + 'ap_setup_make_content_type' + LibSuff4;
+
+{**
+ * Construct an entity tag from the resource information.  If it's a real
+ * file, build in some of the file characteristics.
+ * @param r The current request
+ * @param force_weak Force the entity tag to be weak - it could be modified
+ *                   again in as short an interval.
+ * @return The entity tag
+ *}
+//AP_DECLARE(char *) ap_make_etag(request_rec *r, int force_weak);
+function ap_make_etag(r: Prequest_rec; force_weak: Integer): PChar;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name LibNamePrefix + 'ap_make_etag' + LibSuff8;
+
+{**
+ * Set the E-tag outgoing header
+ * @param r The current request
+ *}
+//AP_DECLARE(void) ap_set_etag(request_rec *r);
+procedure ap_set_etag(r: Prequest_rec);
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name LibNamePrefix + 'ap_set_etag' + LibSuff4;
+
+{**
+ * Set the last modified time for the file being sent
+ * @param r The current request
+ *}
+//AP_DECLARE(void) ap_set_last_modified(request_rec *r);
+procedure ap_set_last_modified(r: Prequest_rec);
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name LibNamePrefix + 'ap_set_last_modified' + LibSuff4;
+
+{**
+ * Implements condition GET rules for HTTP/1.1 specification.  This function
+ * inspects the client headers and determines if the response fulfills
+ * the requirements specified.
+ * @param r The current request
+ * @return OK if the response fulfills the condition GET rules, some
+ *         other status code otherwise
+ *}
+//AP_DECLARE(int) ap_meets_conditions(request_rec *r);
+function ap_meets_conditions(r: Prequest_rec): Integer;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name LibNamePrefix + 'ap_meets_conditions' + LibSuff4;
+
+{* Other ways to send stuff at the client.  All of these keep track
+ * of bytes_sent automatically.  This indirection is intended to make
+ * it a little more painless to slide things like HTTP-NG packetization
+ * underneath the main body of the code later.  In the meantime, it lets
+ * us centralize a bit of accounting (bytes_sent).
+ *
+ * These also return the number of bytes written by the call.
+ * They should only be called with a timeout registered, for obvious reaasons.
+ * (Ditto the send_header stuff).
+ *}
+
+{**
+ * Send an entire file to the client, using sendfile if supported by the
+ * current platform
+ * @param fd The file to send.
+ * @param r The current request
+ * @param offset Offset into the file to start sending.
+ * @param length Amount of data to send
+ * @param nbytes Amount of data actually sent
+ *}
+//AP_DECLARE(apr_status_t) ap_send_fd(apr_file_t *fd, request_rec *r, apr_off_t offset,
+//                                   apr_size_t length, apr_size_t *nbytes);
+function ap_send_fd(fd: Papr_file_t; r: Prequest_rec; offset: apr_off_t;
+                    length: apr_size_t; nbytes: Papr_size_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_send_fd' + LibSuff24;
+
+//#if APR_HAS_MMAP
+{**
+ * Send an MMAP'ed file to the client
+ * @param mm The MMAP'ed file to send
+ * @param r The current request
+ * @param offset The offset into the MMAP to start sending
+ * @param length The amount of data to send
+ * @return The number of bytes sent
+ *}
+//AP_DECLARE(apr_size_t) ap_send_mmap(apr_mmap_t *mm,
+//                                    request_rec *r,
+//                                    apr_size_t offset,
+//                                    apr_size_t length);
+function ap_send_mmap(mm: Papr_mmap_t;
+                      r: Prequest_rec;
+                      offset,
+                      length: apr_size_t): apr_size_t;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name LibNamePrefix + 'ap_send_mmap' + LibSuff20;
+
+//#endif
+
+
+{**
+ * Register a new request method, and return the offset that will be
+ * associated with that method.
+ *
+ * @param p        The pool to create registered method numbers from.
+ * @param methname The name of the new method to register.
+ * @return         Ab int value representing an offset into a bitmask.
+ *}
+//AP_DECLARE(int) ap_method_register(apr_pool_t *p, const char *methname);
+function ap_method_register(p: Papr_pool_t; methname: PChar): Integer;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name LibNamePrefix + 'ap_method_register' + LibSuff8;
+
+{**
+ * Initialize the method_registry and allocate memory for it.
+ *
+ * @param p Pool to allocate memory for the registry from.
+ *}
+//AP_DECLARE(void) ap_method_registry_init(apr_pool_t *p);
+procedure ap_method_registry_init(p: Papr_pool_t);
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name LibNamePrefix + 'ap_method_registry_init' + LibSuff4;
+
+{**
+ * This is a convenience macro to ease with checking a mask
+ * against a method name.
+ *}
+//#define AP_METHOD_CHECK_ALLOWED(mask, methname) \
+//    ((mask) & (AP_METHOD_BIT << ap_method_number_of((methname))))
+
+{**
+ * Create a new method list with the specified number of preallocated
+ * slots for extension methods.
+ *
+ * @param   p       Pointer to a pool in which the structure should be
+ *                  allocated.
+ * @param   nelts   Number of preallocated extension slots
+ * @return  Pointer to the newly created structure.
+ *}
+//AP_DECLARE(ap_method_list_t *) ap_make_method_list(apr_pool_t *p, int nelts);
+function ap_make_method_list(p: Papr_pool_t; nelts: Integer): Pap_method_list_t;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name LibNamePrefix + 'ap_make_method_list' + LibSuff8;
+
+{**
+ * Copy a method list
+ *
+ * @param   dest List to copy to
+ * @param   src  List to copy from
+ *}
+//AP_DECLARE(void) ap_copy_method_list(ap_method_list_t *dest,
+//                                     ap_method_list_t *src);
+procedure ap_copy_method_list(dest, src: Pap_method_list_t);
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name LibNamePrefix + 'ap_copy_method_list' + LibSuff8;
+
+{**
+ * Search for an HTTP method name in an ap_method_list_t structure, and
+ * return true if found.
+ *
+ * @param   method  String containing the name of the method to check.
+ * @param   l       Pointer to a method list, such as r->allowed_methods.
+ * @return  1 if method is in the list, otherwise 0
+ *}
+//AP_DECLARE(int) ap_method_in_list(ap_method_list_t *l, const char *method);
+function ap_method_in_list(l: Pap_method_list_t; const method: PChar): Integer;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name LibNamePrefix + 'ap_method_in_list' + LibSuff8;
+
+{**
+ * Add an HTTP method name to an ap_method_list_t structure if it isn't
+ * already listed.
+ *
+ * @param   method  String containing the name of the method to check.
+ * @param   l       Pointer to a method list, such as r->allowed_methods.
+ * @return  None.
+ *}
+//AP_DECLARE(void) ap_method_list_add(ap_method_list_t *l, const char *method);
+procedure ap_method_list_add(l: Pap_method_list_t; const method: PChar);
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name LibNamePrefix + 'ap_method_list_add' + LibSuff8;
+
+{**
+ * Remove an HTTP method name from an ap_method_list_t structure.
+ *
+ * @param   l       Pointer to a method list, such as r->allowed_methods.
+ * @param   method  String containing the name of the method to remove.
+ * @return  None.
+ *}
+//AP_DECLARE(void) ap_method_list_remove(ap_method_list_t *l,
+//                                       const char *method);
+procedure ap_method_list_remove(l: Pap_method_list_t; const method: PChar);
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name LibNamePrefix + 'ap_method_list_remove' + LibSuff8;
+
+{**
+ * Reset a method list to be completely empty.
+ *
+ * @param   l       Pointer to a method list, such as r->allowed_methods.
+ * @return  None.
+ *}
+//AP_DECLARE(void) ap_clear_method_list(ap_method_list_t *l);
+procedure ap_clear_method_list(l: Pap_method_list_t);
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name LibNamePrefix + 'ap_clear_method_list' + LibSuff4;
+
+{**
+ * Set the content type for this request (r->content_type).
+ * @param r The current request
+ * @param ct The new content type
+ * @warning This function must be called to set r->content_type in order
+ * for the AddOutputFilterByType directive to work correctly.
+ *}
+//AP_DECLARE(void) ap_set_content_type(request_rec *r, const char *ct);
+procedure ap_set_content_type(r: Prequest_rec; const ct: PChar);
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name LibNamePrefix + 'ap_set_content_type' + LibSuff8;
+
+{**
+ * Set the Accept-Ranges header for this response
+ * @param r The current request
+ *}
+//AP_DECLARE(void) ap_set_accept_ranges(request_rec *r);
+procedure ap_set_accept_ranges(r: Prequest_rec);
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name LibNamePrefix + 'ap_set_accept_ranges' + LibSuff4;
+
+{* Hmmm... could macrofy these for now, and maybe forever, though the
+ * definitions of the macros would get a whole lot hairier.
+ *}
+
+{**
+ * Output one character for this request
+ * @param c the character to output
+ * @param r the current request
+ * @return The number of bytes sent
+ *}
+//AP_DECLARE(int) ap_rputc(int c, request_rec *r);
+function ap_rputc(c: Integer; r: Prequest_rec): Integer;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name LibNamePrefix + 'ap_rputc' + LibSuff8;
+
+{**
+ * Write a buffer for the current request
+ * @param buf The buffer to write
+ * @param nbyte The number of bytes to send from the buffer
+ * @param r The current request
+ * @return The number of bytes sent
+ *}
+//AP_DECLARE(int) ap_rwrite(const void *buf, int nbyte, request_rec *r);
+function ap_rwrite(const buf: Pointer; nbyte: Integer; r: Prequest_rec): Integer;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name LibNamePrefix + 'ap_rwrite' + LibSuff12;
+
+{**
+ * Output a string for the current request
+ * @param str The string to output
+ * @param r The current request
+ * @return The number of bytes sent
+ * @note ap_rputs may be implemented as macro or inline function
+ *}
+//static APR_INLINE int ap_rputs(const char *str, request_rec *r)
+//{
+//    return ap_rwrite(str, strlen(str), r);
+//}
+
+{**
+ * Write an unspecified number of strings to the request
+ * @param r The current request
+ * @param ... The strings to write
+ * @return The number of bytes sent
+ *}
+//AP_DECLARE_NONSTD(int) ap_rvputs(request_rec *r,...)
+//                       AP_FN_ATTR_SENTINEL;
+function ap_rvputs(r: Prequest_rec; params: array of const): Integer; cdecl;
+  external LibHTTPD name 'ap_rvputs';
+
+{**
+ * Output data to the client in a printf format
+ * @param r The current request
+ * @param fmt The format string
+ * @param vlist The arguments to use to fill out the format string
+ * @return The number of bytes sent
+ *}
+//AP_DECLARE(int) ap_vrprintf(request_rec *r, const char *fmt, va_list vlist);
+function ap_vrprintf(r: Prequest_rec; const fmt: PChar; vlist: va_list): Integer;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name LibNamePrefix + 'ap_vrprintf' + LibSuff12;
+
+{**
+ * Output data to the client in a printf format
+ * @param r The current request
+ * @param fmt The format string
+ * @param ... The arguments to use to fill out the format string
+ * @return The number of bytes sent
+ *}
+//AP_DECLARE_NONSTD(int) ap_rprintf(request_rec *r, const char *fmt,...)
+//                                __attribute__((format(printf,2,3)));
+function ap_rprintf(r: Prequest_rec;
+                    const fmt: PChar; params: array of const): Integer; cdecl;
+  external LibHTTPD name 'ap_rprintf';
+
+{**
+ * Flush all of the data for the current request to the client
+ * @param r The current request
+ * @return 0 on success, -1 if an error occurred
+ *}
+//AP_DECLARE(int) ap_rflush(request_rec *r);
+function ap_rflush(r: Prequest_rec): Integer;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name LibNamePrefix + 'ap_rflush' + LibSuff4;
+
+{**
+ * Index used in custom_responses array for a specific error code
+ * (only use outside protocol.c is in getting them configured).
+ * @param status HTTP status code
+ * @return The index of the response
+ *}
+//AP_DECLARE(int) ap_index_of_response(int status);
+function ap_index_of_response(status: Integer): Integer;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name LibNamePrefix + 'ap_index_of_response' + LibSuff4;
+
+{**
+ * Return the Status-Line for a given status code (excluding the
+ * HTTP-Version field). If an invalid or unknown status code is
+ * passed, "500 Internal Server Error" will be returned.
+ * @param status The HTTP status code
+ * @return The Status-Line
+ *}
+//AP_DECLARE(const char *) ap_get_status_line(int status);
+function ap_get_status_line(status: Integer): PChar;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name LibNamePrefix + 'ap_get_status_line' + LibSuff4;
+
+//* Reading a block of data from the client connection (e.g., POST arg) */
+
+{**
+ * Setup the client to allow Apache to read the request body.
+ * @param r The current request
+ * @param read_policy How the server should interpret a chunked
+ *                    transfer-encoding.  One of: <pre>
+ *    REQUEST_NO_BODY          Send 413 error if message has any body
+ *    REQUEST_CHUNKED_ERROR    Send 411 error if body without Content-Length
+ *    REQUEST_CHUNKED_DECHUNK  If chunked, remove the chunks for me.
+ * </pre>
+ * @return either OK or an error code
+ *}
+//AP_DECLARE(int) ap_setup_client_block(request_rec *r, int read_policy);
+function ap_setup_client_block(r: Prequest_rec; read_policy: Integer): Integer;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name LibNamePrefix + 'ap_setup_client_block' + LibSuff8;
+
+{**
+ * Determine if the client has sent any data.  This also sends a
+ * 100 Continue response to HTTP/1.1 clients, so modules should not be called
+ * until the module is ready to read content.
+ * @warning Never call this function more than once.
+ * @param r The current request
+ * @return 0 if there is no message to read, 1 otherwise
+ *}
+//AP_DECLARE(int) ap_should_client_block(request_rec *r);
+function ap_should_client_block(r: Prequest_rec): Integer;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name LibNamePrefix + 'ap_should_client_block' + LibSuff4;
+
+{**
+ * Call this in a loop.  It will put data into a buffer and return the length
+ * of the input block
+ * @param r The current request
+ * @param buffer The buffer in which to store the data
+ * @param bufsiz The size of the buffer
+ * @return Number of bytes inserted into the buffer.  When done reading, 0
+ *         if EOF, or -1 if there was an error
+ *}
+//AP_DECLARE(long) ap_get_client_block(request_rec *r, char *buffer, apr_size_t bufsiz);
+function ap_get_client_block(r: Prequest_rec; buffer: PChar; bufsiz: apr_size_t): cLong;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name LibNamePrefix + 'ap_get_client_block' + LibSuff12;
+
+{**
+ * In HTTP/1.1, any method can have a body.  However, most GET handlers
+ * wouldn't know what to do with a request body if they received one.
+ * This helper routine tests for and reads any message body in the request,
+ * simply discarding whatever it receives.  We need to do this because
+ * failing to read the request body would cause it to be interpreted
+ * as the next request on a persistent connection.
+ * @param r The current request
+ * @return error status if request is malformed, OK otherwise
+ *}
+//AP_DECLARE(int) ap_discard_request_body(request_rec *r);
+function ap_discard_request_body(r: Prequest_rec): Integer;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name LibNamePrefix + 'ap_discard_request_body' + LibSuff4;
+
+{**
+ * Setup the output headers so that the client knows how to authenticate
+ * itself the next time, if an authentication request failed.
+ * @param r The current request
+ *}
+//AP_DECLARE(void) ap_note_auth_failure(request_rec *r);
+procedure ap_note_auth_failure(r: Prequest_rec);
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name LibNamePrefix + 'ap_note_auth_failure' + LibSuff4;
+
+{**
+ * @deprecated @see ap_note_auth_failure
+ *}
+//AP_DECLARE(void) ap_note_basic_auth_failure(request_rec *r);
+procedure ap_note_basic_auth_failure(r: Prequest_rec);
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name LibNamePrefix + 'ap_note_basic_auth_failure' + LibSuff4;
+
+{**
+ * @deprecated @see ap_note_auth_failure
+ *}
+//AP_DECLARE(void) ap_note_digest_auth_failure(request_rec *r);
+procedure ap_note_digest_auth_failure(r: Prequest_rec);
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name LibNamePrefix + 'ap_note_digest_auth_failure' + LibSuff4;
+
+{**
+ * This hook allows modules to add support for a specific auth type to
+ * ap_note_auth_failure
+ * @param r the current request
+ * @param auth_type the configured auth_type
+ * @return OK, DECLINED
+ *}
+//AP_DECLARE_HOOK(int, note_auth_failure, (request_rec *r, const char *auth_type))
+(*macro expanded:
+  typedef
+    int ap_HOOK_note_auth_failure_t (request_rec *r, const char *auth_type);
+
+    void ap_hook_note_auth_failure(ap_HOOK_note_auth_failure_t *pf, const char * const *aszPre, const char * const *aszSucc, int nOrder);
+    int ap_run_note_auth_failure (request_rec *r, const char *auth_type);
+    apr_array_header_t * ap_hook_get_note_auth_failure(void);
+
+  typedef struct ap_LINK_note_auth_failure_t { ap_HOOK_note_auth_failure_t *pFunc; const char *szName; const char * const *aszPredecessors; const char * const *aszSuccessors; int nOrder; } ap_LINK_note_auth_failure_t;
+*)
+type
+  ap_HOOK_note_auth_failure_t = procedure(r: Prequest_rec); cdecl;
+
+procedure ap_hook_note_auth_failure(pf: ap_HOOK_note_auth_failure_t;
+                                            const aszPre, aszSucc: PPChar;
+                                            nOrder: Integer);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_HOOK_note_auth_failure' + LibSuff16;
+
+procedure ap_run_note_auth_failure(r: Prequest_rec; auth_type: PChar);
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name LibNamePrefix + 'ap_run_note_auth_failure' + LibSuff8;
+
+function ap_hook_get_note_auth_failure: Papr_array_header_t;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name LibNamePrefix + 'ap_hook_get_note_auth_failure' + LibSuff0;
+
+{rest of macro ignored}
+
+{**
+ * Get the password from the request headers
+ * @param r The current request
+ * @param pw The password as set in the headers
+ * @return 0 (OK) if it set the 'pw' argument (and assured
+ *         a correct value in r->user); otherwise it returns
+ *         an error code, either HTTP_INTERNAL_SERVER_ERROR if things are
+ *         really confused, HTTP_UNAUTHORIZED if no authentication at all
+ *         seemed to be in use, or DECLINED if there was authentication but
+ *         it wasn't Basic (in which case, the caller should presumably
+ *         decline as well).
+ *}
+//AP_DECLARE(int) ap_get_basic_auth_pw(request_rec *r, const char **pw);
+function ap_get_basic_auth_pw(r: Prequest_rec; pw: PPChar): Integer;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name LibNamePrefix + 'ap_get_basic_auth_pw' + LibSuff8;
+
+{**
+ * parse_uri: break apart the uri
+ * @warning Side Effects:
+ *    @li sets r->args to rest after '?' (or NULL if no '?')
+ *    @li sets r->uri to request uri (without r->args part)
+ *    @li sets r->hostname (if not set already) from request (scheme://host:port)
+ * @param r The current request
+ * @param uri The uri to break apart
+ *}
+//AP_CORE_DECLARE(void) ap_parse_uri(request_rec *r, const char *uri);
+procedure ap_parse_uri(r: Prequest_rec; const uri: PChar);
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name LibNamePrefix + 'ap_parse_uri' + LibSuff8;
+
+{**
+ * Get the next line of input for the request
+ * @param s The buffer into which to read the line
+ * @param n The size of the buffer
+ * @param r The request
+ * @param fold Whether to merge continuation lines
+ * @return The length of the line, if successful
+ *         n, if the line is too big to fit in the buffer
+ *         -1 for miscellaneous errors
+ *}
+//AP_DECLARE(int) ap_getline(char *s, int n, request_rec *r, int fold);
+function ap_getline(s: PChar; n: Integer; r: Prequest_rec; fold: Integer): Integer;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name LibNamePrefix + 'ap_getline' + LibSuff16;
+
+{**
+ * Get the next line of input for the request
+ *
+ * Note: on ASCII boxes, ap_rgetline is a macro which simply calls
+ *       ap_rgetline_core to get the line of input.
+ *
+ *       on EBCDIC boxes, ap_rgetline is a wrapper function which
+ *       translates ASCII protocol lines to the local EBCDIC code page
+ *       after getting the line of input.
+ *
+ * @param s Pointer to the pointer to the buffer into which the line
+ *          should be read; if *s==NULL, a buffer of the necessary size
+ *          to hold the data will be allocated from the request pool
+ * @param n The size of the buffer
+ * @param read The length of the line.
+ * @param r The request
+ * @param fold Whether to merge continuation lines
+ * @param bb Working brigade to use when reading buckets
+ * @return APR_SUCCESS, if successful
+ *         APR_ENOSPC, if the line is too big to fit in the buffer
+ *         Other errors where appropriate
+ *}
+//#if APR_CHARSET_EBCDIC
+//AP_DECLARE(apr_status_t) ap_rgetline(char **s, apr_size_t n,
+//                                     apr_size_t *read,
+//                                     request_rec *r, int fold,
+//                                     apr_bucket_brigade *bb);
+//#else //* ASCII box */
+//#define ap_rgetline(s, n, read, r, fold, bb) \
+//        ap_rgetline_core((s), (n), (read), (r), (fold), (bb))
+//#endif
+
+{** @see ap_rgetline *}
+//AP_DECLARE(apr_status_t) ap_rgetline_core(char **s, apr_size_t n,
+//                                          apr_size_t *read,
+//                                          request_rec *r, int fold,
+//                                          apr_bucket_brigade *bb);
+function ap_rgetline_core(s: PPChar; n: apr_size_t;
+                          read: Papr_size_t;
+                          r: Prequest_rec; fold: Integer;
+                          bb: apr_bucket_brigade): apr_status_t;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name LibNamePrefix + 'ap_rgetline_core' + LibSuff24;
+
+{**
+ * Get the method number associated with the given string, assumed to
+ * contain an HTTP method.  Returns M_INVALID if not recognized.
+ * @param method A string containing a valid HTTP method
+ * @return The method number
+ *}
+//AP_DECLARE(int) ap_method_number_of(const char *method);
+function ap_method_number_of(const method: PChar): Integer;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name LibNamePrefix + 'ap_method_number_of' + LibSuff4;
+
+{**
+ * Get the method name associated with the given internal method
+ * number.  Returns NULL if not recognized.
+ * @param p A pool to use for temporary allocations.
+ * @param methnum An integer value corresponding to an internal method number
+ * @return The name corresponding to the method number
+ *}
+//AP_DECLARE(const char *) ap_method_name_of(apr_pool_t *p, int methnum);
+function ap_method_name_of(p: Papr_pool_t; methnum: Integer): PChar;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name LibNamePrefix + 'ap_method_name_of' + LibSuff8;
+
+
+//* Hooks */
+{*
+ * pre_read_request --- run right before read_request_line(),
+ *                  and not run during any subrequests.
+ *}
+{**
+ * This hook allows modules to affect the request or connection immediately before
+ * the request has been read, and before any other phases have been processes.
+ * @param r The current request of the soon-to-be-read request
+ * @param c The connection
+ * @return None/void
+ *}
+//AP_DECLARE_HOOK(void,pre_read_request,(request_rec *r, conn_rec *c))
+(*macro expanded:
+  typedef
+    void ap_HOOK_pre_read_request_t (request_rec *r, conn_rec *c);
+
+    void ap_hook_pre_read_request(ap_HOOK_pre_read_request_t *pf,
+                                  const char * const *aszPre,
+                                  const char * const *aszSucc,
+                                  int nOrder);
+    void ap_run_pre_read_request (request_rec *r,
+                                  conn_rec *c);
+    apr_array_header_t * ap_hook_get_pre_read_request(void);
+
+  typedef struct ap_LINK_pre_read_request_t { ap_HOOK_pre_read_request_t *pFunc; const char *szName; const char * const *aszPredecessors; const char * const *aszSuccessors; int nOrder; } ap_LINK_pre_read_request_t;
+*)
+type
+   ap_HOOK_pre_read_request_t = function(r: Prequest_rec): Integer; cdecl;
+
+procedure ap_hook_pre_read_request(pf: ap_HOOK_pre_read_request_t;
+                                    const aszPre: PPChar;
+                                    const aszSucc: PPChar;
+                                    nOrder: Integer);
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name LibNamePrefix + 'ap_hook_pre_read_request' + LibSuff16;
+
+function ap_run_pre_read_request(r: Prequest_rec; c: Pconn_rec): Integer;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name LibNamePrefix + 'ap_run_pre_read_request' + LibSuff8;
+
+function  ap_hook_get_pre_read_request: Papr_array_header_t;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name LibNamePrefix + 'ap_hook_get_pre_read_request' + LibSuff0;
+
+{rest of macro ignored}
+
+{*
+ * post_read_request --- run right after read_request or internal_redirect,
+ *                  and not run during any subrequests.
+ *}
+{**
+ * This hook allows modules to affect the request immediately after the request
+ * has been read, and before any other phases have been processes.  This allows
+ * modules to make decisions based upon the input header fields
+ * @param r The current request
+ * @return OK or DECLINED
+ *}
+//AP_DECLARE_HOOK(int,post_read_request,(request_rec *r))
+(*macro expanded:
+  typedef
+    int ap_HOOK_post_read_request_t (request_rec *r);
+
+    void ap_hook_post_read_request(ap_HOOK_post_read_request_t *pf,
+                                   const char * const *aszPre,
+                                   const char * const *aszSucc,
+                                   int nOrder);
+    int ap_run_post_read_request (request_rec *r);
+    apr_array_header_t * ap_hook_get_post_read_request(void);
+
+  typedef struct ap_LINK_post_read_request_t { ap_HOOK_post_read_request_t *pFunc; const char *szName; const char * const *aszPredecessors; const char * const *aszSuccessors; int nOrder; } ap_LINK_post_read_request_t;
+*)
+type
+   ap_HOOK_post_read_request_t = function(r: Prequest_rec): Integer; cdecl;
+
+procedure ap_hook_post_read_request(pf: ap_HOOK_post_read_request_t;
+                                    const aszPre: PPChar;
+                                    const aszSucc: PPChar;
+                                    nOrder: Integer);
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name LibNamePrefix + 'ap_hook_post_read_request' + LibSuff16;
+
+function ap_run_post_read_request(r: Prequest_rec): Integer;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name LibNamePrefix + 'ap_run_post_read_request' + LibSuff4;
+
+function  ap_hook_get_post_read_request: Papr_array_header_t;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name LibNamePrefix + 'ap_hook_get_post_read_request' + LibSuff0;
+
+{rest of macro ignored}
+
+{**
+ * This hook allows modules to perform any module-specific logging activities
+ * over and above the normal server things.
+ * @param r The current request
+ * @return OK, DECLINED, or HTTP_...
+ *}
+//AP_DECLARE_HOOK(int,log_transaction,(request_rec *r))
+(*macro expanded:
+  typedef
+    int ap_HOOK_log_transaction_t (request_rec *r);
+
+    void ap_hook_log_transaction(ap_HOOK_log_transaction_t *pf,
+                                 const char * const *aszPre,
+                                 const char * const *aszSucc,
+                                 int nOrder);
+    int ap_run_log_transaction (request_rec *r);
+    apr_array_header_t * ap_hook_get_log_transaction(void);
+
+  typedef struct ap_LINK_log_transaction_t { ap_HOOK_log_transaction_t *pFunc; const char *szName; const char * const *aszPredecessors; const char * const *aszSuccessors; int nOrder; } ap_LINK_log_transaction_t;
+*)
+type
+   ap_HOOK_log_transaction_t = function(r: Prequest_rec): Integer; cdecl;
+
+procedure ap_hook_log_transaction(pf: ap_HOOK_log_transaction_t;
+                                  const aszPre: PPChar;
+                                  const aszSucc: PPChar;
+                                  nOrder: Integer);
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name LibNamePrefix + 'ap_hook_log_transaction' + LibSuff16;
+
+function ap_run_log_transaction(r: Prequest_rec): Integer;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name LibNamePrefix + 'ap_run_log_transaction' + LibSuff4;
+
+function  ap_hook_get_log_transaction: Papr_array_header_t;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name LibNamePrefix + 'ap_hook_get_log_transaction' + LibSuff0;
+
+{rest of macro ignored}
+
+{**
+ * This hook allows modules to retrieve the http scheme for a request.  This
+ * allows Apache modules to easily extend the schemes that Apache understands
+ * @param r The current request
+ * @return The http scheme from the request
+ *}
+//AP_DECLARE_HOOK(const char *,http_scheme,(const request_rec *r))
+(*macro expanded:
+  typedef
+    const char * ap_HOOK_http_scheme_t (const request_rec *r);
+
+    void ap_hook_http_scheme(ap_HOOK_http_scheme_t *pf, const char * const *aszPre, const char * const *aszSucc, int nOrder);
+    const char * ap_run_http_scheme (const request_rec *r);
+    apr_array_header_t * ap_hook_get_http_scheme(void);
+
+  typedef struct ap_LINK_http_scheme_t { ap_HOOK_http_scheme_t *pFunc; const char *szName; const char * const *aszPredecessors; const char * const *aszSuccessors; int nOrder; } ap_LINK_http_scheme_t;
+*)
+type
+   ap_HOOK_http_scheme_t = function(r: Prequest_rec): Integer; cdecl;
+
+procedure ap_hook_http_scheme(pf: ap_HOOK_http_scheme_t;
+                              const aszPre: PPChar;
+                              const aszSucc: PPChar;
+                              nOrder: Integer);
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name LibNamePrefix + 'ap_hook_http_scheme' + LibSuff16;
+
+function ap_run_http_scheme(r: Prequest_rec): Integer;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name LibNamePrefix + 'ap_run_http_scheme' + LibSuff4;
+
+function  ap_hook_get_http_scheme: Papr_array_header_t;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name LibNamePrefix + 'ap_hook_get_http_scheme' + LibSuff0;
+
+{rest of macro ignored}
+
+{**
+ * Return the default port from the current request
+ * @param r The current request
+ * @return The current port
+ *}
+//AP_DECLARE_HOOK(apr_port_t,default_port,(const request_rec *r))
+(*macro expanded:
+  typedef
+    apr_port_t ap_HOOK_default_port_t (const request_rec *r);
+
+    void ap_hook_default_port(ap_HOOK_default_port_t *pf, const char * const *aszPre, const char * const *aszSucc, int nOrder);
+    apr_port_t ap_run_default_port (const request_rec *r);
+    apr_array_header_t * ap_hook_get_default_port(void);
+
+  typedef struct ap_LINK_default_port_t { ap_HOOK_default_port_t *pFunc; const char *szName; const char * const *aszPredecessors; const char * const *aszSuccessors; int nOrder; } ap_LINK_default_port_t;
+*)
+  type
+     ap_HOOK_default_port_t = function(r: Prequest_rec): Integer; cdecl;
+
+  procedure ap_hook_default_port(pf: ap_HOOK_default_port_t;
+                                 const aszPre: PPChar;
+                                 const aszSucc: PPChar;
+                                 nOrder: Integer);
+    {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+    external LibHTTPD name LibNamePrefix + 'ap_hook_default_port' + LibSuff16;
+
+  function ap_run_default_port(r: Prequest_rec): Integer;
+    {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+    external LibHTTPD name LibNamePrefix + 'ap_run_default_port' + LibSuff4;
+
+  function  ap_hook_get_default_port: Papr_array_header_t;
+    {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+    external LibHTTPD name LibNamePrefix + 'ap_hook_get_default_port' + LibSuff0;
+
+  {rest of macro ignored}
+
+{** @see ap_bucket_type_error *}
+//typedef struct ap_bucket_error ap_bucket_error;
+type
+  Pap_bucket_error = ^ap_bucket_error;
+
+{**
+ * @struct ap_bucket_error
+ * @brief  A bucket referring to an HTTP error
+ *
+ * This bucket can be passed down the filter stack to indicate that an
+ * HTTP error occurred while running a filter.  In order for this bucket
+ * to be used successfully, it MUST be sent as the first bucket in the
+ * first brigade to be sent from a given filter.
+ *}
+  ap_bucket_error = record
+    {** Number of buckets using this memory *}
+    refcount: apr_bucket_refcount;
+    {** The error code *}
+    status: Integer;
+    {** The error string *}
+    data: PChar;
+  end;
+
+{** @see ap_bucket_type_error *}
+//AP_DECLARE_DATA extern const apr_bucket_type_t ap_bucket_type_error;
+
+{**
+ * Determine if a bucket is an error bucket
+ * @param e The bucket to inspect
+ * @return true or false
+ *}
+//#define AP_BUCKET_IS_ERROR(e)         (e->type == &ap_bucket_type_error)
+
+{**
+ * Make the bucket passed in an error bucket
+ * @param b The bucket to make into an error bucket
+ * @param error The HTTP error code to put in the bucket.
+ * @param buf An optional error string to put in the bucket.
+ * @param p A pool to allocate out of.
+ * @return The new bucket, or NULL if allocation failed
+ *}
+//AP_DECLARE(apr_bucket *) ap_bucket_error_make(apr_bucket *b, int error,
+//                const char *buf, apr_pool_t *p);
+function ap_bucket_error_make(b: Papr_bucket; error: Integer;
+                              const buf: PChar; p: Papr_pool_t): Papr_bucket;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name LibNamePrefix + 'ap_bucket_error_make' + LibSuff16;
+
+{**
+ * Create a bucket referring to an HTTP error.
+ * @param error The HTTP error code to put in the bucket.
+ * @param buf An optional error string to put in the bucket.
+ * @param p A pool to allocate the error string out of.
+ * @param list The bucket allocator from which to allocate the bucket
+ * @return The new bucket, or NULL if allocation failed
+ *}
+//AP_DECLARE(apr_bucket *) ap_bucket_error_create(int error, const char *buf,
+//                                                apr_pool_t *p,
+//                                                apr_bucket_alloc_t *list);
+function ap_bucket_error_create(error: Integer; const buf: PChar;
+                                p: Papr_pool_t;
+                                list: Papr_bucket_alloc_t): Papr_bucket;
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name LibNamePrefix + 'ap_bucket_error_create' + LibSuff16;
+
+//AP_DECLARE_NONSTD(apr_status_t) ap_byterange_filter(ap_filter_t *f, apr_bucket_brigade *b);
+function ap_byterange_filter(f: Pap_filter_t; b: Papr_bucket_brigade): apr_status_t; cdecl;
+  external LibHTTPD name 'ap_byterange_filter';
+
+//AP_DECLARE_NONSTD(apr_status_t) ap_http_header_filter(ap_filter_t *f, apr_bucket_brigade *b);
+function ap_http_header_filter(f: Pap_filter_t; b: Papr_bucket_brigade): apr_status_t; cdecl;
+  external LibHTTPD name 'ap_http_header_filter';
+
+//AP_DECLARE_NONSTD(apr_status_t) ap_content_length_filter(ap_filter_t *,
+//                                                              apr_bucket_brigade *);
+function ap_content_length_filter(f: Pap_filter_t;
+                                  b: Papr_bucket_brigade): apr_status_t; cdecl;
+  external LibHTTPD name 'ap_content_length_filter';
+
+//AP_DECLARE_NONSTD(apr_status_t) ap_old_write_filter(ap_filter_t *f, apr_bucket_brigade *b);
+function ap_old_write_filter(f: Pap_filter_t; b: Papr_bucket_brigade): apr_status_t; cdecl;
+  external LibHTTPD name 'ap_old_write_filter';
+
+{**
+ * Sett up the protocol fields for subsidiary requests
+ * @param rnew New Sub Request
+ * @param r current request
+ *}
+//AP_DECLARE(void) ap_set_sub_req_protocol(request_rec *rnew, const request_rec *r);
+procedure ap_set_sub_req_protocol(rnew: Prequest_rec; const r: Prequest_rec);
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name LibNamePrefix + 'ap_set_sub_req_protocol' + LibSuff8;
+
+{**
+ * A wrapup function to keep the internal accounting straight.
+ * Indicates that there is no more content coming.
+ * @param sub_r Subrequest that is now compete
+ *}
+//AP_DECLARE(void) ap_finalize_sub_req_protocol(request_rec *sub_r);
+procedure ap_finalize_sub_req_protocol(sub_r: Prequest_rec);
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name LibNamePrefix + 'ap_finalize_sub_req_protocol' + LibSuff4;
+
+{**
+ * Send an interim (HTTP 1xx) response immediately.
+ * @param r The request
+ * @param send_headers Whether to send&clear headers in r->headers_out
+ *}
+//AP_DECLARE(void) ap_send_interim_response(request_rec *r, int send_headers);
+procedure ap_send_interim_response(r: Prequest_rec; send_headers: Integer);
+  {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+  external LibHTTPD name LibNamePrefix + 'ap_send_interim_response' + LibSuff8;
+
+
+//#endif  /* !APACHE_HTTP_PROTOCOL_H */
+(** @} *)

+ 2244 - 0
packages/httpd24/src/httpd.inc

@@ -0,0 +1,2244 @@
+{
+ Converted using the Apache 2.4.3 httpd-2.4.3 source files
+ to be used with FreePascal (fpc)
+}
+{* XXX - We need to push more stuff to other .h files, or even .c files, to
+ * make this file smaller}
+
+{ Headers in which EVERYONE has an interest...  }
+{$include ap_config.inc}
+{$include ap_mmn.inc}
+{$include ap_release.inc}
+{all translated apr are included in the parent httpd.pas unit with using the apr.pas unit}
+////{$include "apr_general.inc"}
+//{$include "apr_tables.inc"}
+//{$include "apr_pools.inc"}
+////{$include "apr_time.inc"}
+////{$include "apr_network_io.inc"}
+{$include aprutil/apr_buckets.inc}
+{$include aprutil/apr_uri.inc}
+//{$include "apr_poll.inc"}
+//{$include "apr_thread_proc.inc"}
+////{$include "os.inc"}
+{$include ap_regex.inc}
+
+{ Note: apr_uri.h is also included, see below  }
+
+{ ----------------------------- config dir ------------------------------  }
+{* Define this to be the default server home dir. Most things later in this
+ * file with a relative pathname will have this added.
+  }
+
+const
+{$ifdef OS2}
+  {* Set default for OS/2 file system  }
+    HTTPD_ROOT = '/os2httpd';    
+{$else}
+  {$ifdef WIN32}
+  {* Set default for Windows file system  }
+    HTTPD_ROOT = '/apache';    
+  {$else}
+    {$ifdef NETWARE}
+  {* Set the default for NetWare  }
+    HTTPD_ROOT = '/apache';    
+   {$else}
+  {* Set for all other OSs  }
+    HTTPD_ROOT = '/usr/local/apache';    
+    {$endif}
+  {$endif}
+{$endif}
+{ HTTPD_ROOT  }
+
+{* --------- You shouldn't have to edit anything below this line ----------
+ *
+ * Any modifications to any defaults not defined above should be done in the
+ * respective configuration file.
+ *}
+
+{*
+ * Default location of documents.  Can be overridden by the DocumentRoot
+ * directive.}
+{$ifdef OS2}
+  { Set default for OS/2 file system  }
+    DOCUMENT_LOCATION  = HTTPD_ROOT + '/docs';
+{$else}
+  { Set default for non OS/2 file system  }
+    DOCUMENT_LOCATION  = HTTPD_ROOT + '/htdocs';
+{$endif}
+
+    {* Maximum number of dynamically loaded modules  }
+    DYNAMIC_MODULE_LIMIT = 256;      
+
+    {* Default administrator's address  }
+    DEFAULT_ADMIN = '[no address given]';      
+
+    {* The name of the log files  }
+    DEFAULT_ERRORLOG = 'logs/error_log';      
+
+    {* Define this to be what your per-directory security files are called  }
+{$ifdef OS2}
+    { Set default for OS/2 file system  }
+    DEFAULT_ACCESS_FNAME = 'htaccess';      
+{$else}
+    DEFAULT_ACCESS_FNAME = '.htaccess';      
+{$endif}
+
+    {* The name of the server config file  }
+    SERVER_CONFIG_FILE = 'conf/httpd.conf';      
+
+    {* The default path for CGI scripts if none is currently set  }
+    DEFAULT_PATH = '/bin:/usr/bin:/usr/ucb:/usr/bsd:/usr/local/bin';      
+
+    {* The path to the suExec wrapper, can be overridden in Configuration  }
+    SUEXEC_BIN = HTTPD_ROOT + '/bin/suexec';
+
+    {* The timeout for waiting for messages  }
+    DEFAULT_TIMEOUT = 60;      
+
+    {* The timeout for waiting for keepalive timeout until next request  }
+    DEFAULT_KEEPALIVE_TIMEOUT = 5;      
+
+    {* The number of requests to entertain per connection  }
+    DEFAULT_KEEPALIVE = 100;      
+
+    {
+     * Limits on the size of various request items.  These limits primarily
+     * exist to prevent simple denial-of-service attacks on a server based
+     * on misuse of the protocol.  The recommended values will depend on the
+     * nature of the server resources -- CGI scripts and database backends
+     * might require large values, but most servers could get by with much
+     * smaller limits than we use below.  The request message body size can
+     * be limited by the per-dir config directive LimitRequestBody.
+     *
+     * Internal buffer sizes are two bytes more than the DEFAULT_LIMIT_REQUEST_LINE
+     * and DEFAULT_LIMIT_REQUEST_FIELDSIZE below, which explains the 8190.
+     * These two limits can be lowered or raised by the server config
+     * directives LimitRequestLine and LimitRequestFieldsize, respectively.
+     *
+     * DEFAULT_LIMIT_REQUEST_FIELDS can be modified or disabled (set = 0) by
+     * the server config directive LimitRequestFields.
+      }
+    {* default limit on bytes in Request-Line (Method+URI+HTTP-version)  }
+    DEFAULT_LIMIT_REQUEST_LINE = 8190;      
+
+    {* default limit on bytes in any one header field   }
+    DEFAULT_LIMIT_REQUEST_FIELDSIZE = 8190;      
+
+    {* default limit on number of request header fields  }
+    DEFAULT_LIMIT_REQUEST_FIELDS = 100;      
+
+    {*
+     * The default default character set name to add if AddDefaultCharset is
+     * enabled.  Overridden with AddDefaultCharsetName.
+      }
+    DEFAULT_ADD_DEFAULT_CHARSET_NAME = 'iso-8859-1';      
+
+    {* default HTTP Server protocol  }
+    AP_SERVER_PROTOCOL = 'HTTP/1.1';      
+
+    { ------------------ stuff that modules are allowed to look at -----------  }
+    {* Define this to be what your HTML directory content files are called  }
+    AP_DEFAULT_INDEX = 'index.html';      
+
+    {* The name of the MIME types file  }
+    AP_TYPES_CONFIG_FILE = 'conf/mime.types';      
+
+    {
+     * Define the HTML doctype strings centrally.
+      }
+    {* HTML 2.0 Doctype  }
+    DOCTYPE_HTML_2_0 = '<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">' + LineEnding;      
+
+    {* HTML 3.2 Doctype  }
+    DOCTYPE_HTML_3_2 = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">' + LineEnding;      
+
+    {* HTML 4.0 Strict Doctype  }
+    DOCTYPE_HTML_4_0S = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"' + LineEnding +
+                        'http://www.w3.org/TR/REC-html40/strict.dtd">' + LineEnding;      
+
+    {* HTML 4.0 Transitional Doctype  }
+    DOCTYPE_HTML_4_0T = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"' + LineEnding +
+                        '"http://www.w3.org/TR/REC-html40/loose.dtd">' + LineEnding;      
+
+    {* HTML 4.0 Frameset Doctype  }
+    DOCTYPE_HTML_4_0F = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN"' + LineEnding +
+                        '"http://www.w3.org/TR/REC-html40/frameset.dtd">' + LineEnding;      
+
+    {* XHTML 1.0 Strict Doctype  }
+    DOCTYPE_XHTML_1_0S = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"' + LineEnding +
+                         '"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">' + LineEnding;
+
+    {* XHTML 1.0 Transitional Doctype  }
+    DOCTYPE_XHTML_1_0T = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"' + LineEnding +
+                         '"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">' + LineEnding;      
+
+    {* XHTML 1.0 Frameset Doctype  }
+    DOCTYPE_XHTML_1_0F = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"' + LineEnding +
+                         '"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">' + LineEnding;
+
+    {* Internal representation for a HTTP protocol number, e.g., HTTP/1.1  }
+    { was #define dname(params) para_def_expr }
+    { argument types are unknown }
+    { return type might be wrong }   
+    function HTTP_VERSION(major,minor : Integer) : Integer;    
+
+    {* Major part of HTTP protocol  }
+    function HTTP_VERSION_MAJOR(number : Integer) : Integer;
+
+    {* Minor part of HTTP protocol  }
+    function HTTP_VERSION_MINOR(number : Integer) : Integer;
+
+    { -------------- Port number for server running standalone ---------------  }
+    const
+    {* default HTTP Port  }
+      DEFAULT_HTTP_PORT = 80;      
+    {* default HTTPS Port  }
+      DEFAULT_HTTPS_PORT = 443;      
+    {*
+     * Check whether @a port is the default port for the request @a r.
+     * @param port The port number
+     * @param r The request
+     * @see #ap_default_port
+      }
+    { was #define dname(params) para_def_expr }
+    { argument types are unknown }
+    { return type might be wrong }   
+//    function ap_is_default_port(port,r : longint) : longint;    
+
+  {*
+   * Get the default port for a request (which depends on the scheme).
+   * @param r The request
+    }
+  { was #define dname(params) para_def_expr }
+  { argument types are unknown }
+  { return type might be wrong }   
+//  function ap_default_port(r : longint) : longint;  
+
+  {*
+   * Get the scheme for a request.
+   * @param r The request
+    }
+  { was #define dname(params) para_def_expr }
+  { argument types are unknown }
+  { return type might be wrong }   
+//  function ap_http_scheme(r : longint) : longint;  
+
+  const
+  {* The length of a Huge string  }
+    HUGE_STRING_LEN = 8192;
+
+  {* The default string length  }
+    MAX_STRING_LEN = HUGE_STRING_LEN;    
+
+  {* The size of the server's internal read-write buffers  }
+    AP_IOBUFSIZE = 8192;    
+
+  {* The max number of regex captures that can be expanded by ap_pregsub  }
+    AP_MAX_REG_MATCH = 10;    
+
+  {*
+   * APR_HAS_LARGE_FILES introduces the problem of spliting sendfile into
+   * mutiple buckets, no greater than MAX(apr_size_t), and more granular
+   * than that in case the brigade code/filters attempt to read it directly.
+   * ### 16mb is an invention, no idea if it is reasonable.
+    }
+  { 2^24  }
+    AP_MAX_SENDFILE = 16777216;    
+
+  {*
+   * MPM child process exit status values
+   * The MPM parent process may check the status to see if special
+   * error handling is required.
+    }
+  {* a normal exit  }
+    APEXIT_OK = $0;    
+
+  {* A fatal error arising during the server's init sequence  }
+    APEXIT_INIT = $2;    
+
+  {*  The child died during its init sequence  }
+    APEXIT_CHILDINIT = $3;    
+
+  {*
+   *   The child exited due to a resource shortage.
+   *   The parent should limit the rate of forking until
+   *   the situation is resolved.
+    }
+    APEXIT_CHILDSICK = $7;    
+
+  {*
+   *     A fatal error, resulting in the whole server aborting.
+   *     If a child exits with this error, the parent process
+   *     considers this a server-wide fatal error and aborts.
+    }
+    APEXIT_CHILDFATAL = $f;    
+
+  {*
+   * Stuff marked #AP_DECLARE is part of the API, and intended for use
+   * by modules. Its purpose is to allow us to add attributes that
+   * particular platforms or compilers require to every exported function.
+    }
+  { was #define dname(params) para_def_expr }
+  { argument types are unknown }
+  { return type might be wrong }   
+//  function AP_DECLARE(_type : longint) : longint;  
+
+  {*
+   * Stuff marked #AP_DECLARE_NONSTD is part of the API, and intended for
+   * use by modules.  The difference between #AP_DECLARE and
+   * #AP_DECLARE_NONSTD is that the latter is required for any functions
+   * which use varargs or are used via indirect function call.  This
+   * is to accomodate the two calling conventions in windows dlls.
+    }
+  { was #define dname(params) para_def_expr }
+  { argument types are unknown }
+  { return type might be wrong }   
+//  function AP_DECLARE_NONSTD(_type : longint) : longint;  
+
+
+{$define AP_DECLARE_DATA}  
+
+  { was #define dname(params) para_def_expr }
+  { argument types are unknown }
+  { return type might be wrong }   
+//  function AP_MODULE_DECLARE(_type : longint) : longint;  
+
+  { was #define dname(params) para_def_expr }
+  { argument types are unknown }
+  { return type might be wrong }   
+//  function AP_MODULE_DECLARE_NONSTD(_type : longint) : longint;  
+
+{$define AP_MODULE_DECLARE_DATA}  
+
+  {*
+   * @internal
+   * modules should not use functions marked AP_CORE_DECLARE
+    }
+//  const
+//    AP_CORE_DECLARE = AP_DECLARE;    
+
+  {*
+   * @internal
+   * modules should not use functions marked AP_CORE_DECLARE_NONSTD
+    }
+//  const
+//    AP_CORE_DECLARE_NONSTD = AP_DECLARE_NONSTD;    
+
+  {*
+   * @defgroup APACHE_APR_STATUS_T HTTPD specific values of apr_status_t
+   * @
+    }
+
+//  const
+//    AP_START_USERERR = APR_OS_START_USERERR+2000;    
+//    AP_USERERR_LEN = 1000;    
+  {* The function declines to handle the request  }
+//    AP_DECLINED = AP_START_USERERR+0;    
+
+  {* @  }
+  {*
+   * @brief The numeric version information is broken out into fields within this
+   * structure.
+    }
+  {*< major number  }
+  {*< minor number  }
+  {*< patch number  }
+(* Const before type ignored *)
+  {*< additional string like "-dev"  }
+
+  type
+    Pap_version_t = ^ap_version_t;
+    ap_version_t = record
+        major : Integer;
+        minor : Integer;
+        patch : Integer;
+        add_string : PChar;
+      end;
+
+  {*
+   * Return httpd's version information in a numeric form.
+   *
+   *  @param version Pointer to a version structure for returning the version
+   *                 information.
+    }
+  procedure ap_get_server_revision(version: Pap_version_t);
+    {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+    external LibHTTPD name LibNamePrefix + 'ap_get_server_revision' + LibSuff4;
+
+  {*
+   * Get the server banner in a form suitable for sending over the
+   * network, with the level of information controlled by the
+   * ServerTokens directive.
+   * @return The server banner
+    }
+  function ap_get_server_banner: PChar;
+    {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+    external LibHTTPD name LibNamePrefix + 'ap_get_server_revision' + LibSuff0;
+
+  {*
+   * Get the server description in a form suitable for local displays,
+   * status reports, or logging.  This includes the detailed server
+   * version and information about some modules.  It is not affected
+   * by the ServerTokens directive.
+   * @return The server description
+    }
+  function ap_get_server_description: PChar;
+    {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+    external LibHTTPD name LibNamePrefix + 'ap_get_server_revision' + LibSuff0;
+
+  {*
+   * Add a component to the server description and banner strings
+   * @param pconf The pool to allocate the component from
+   * @param component The string to add
+    }
+  procedure ap_add_version_component(pconf: Papr_pool_t; const component: PChar);
+   {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+   external LibHTTPD name LibNamePrefix + 'ap_add_version_component' + LibSuff8;
+
+  {*
+   * Get the date a time that the server was built
+   * @return The server build time string
+    }
+  function ap_get_server_built: PChar;
+    {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+    external LibHTTPD name LibNamePrefix + 'ap_get_server_built' + LibSuff0;
+
+  { non-HTTP status codes returned by hooks  }
+  const
+    OK = 0;    		{*< Module has handled this stage.  }
+    DECLINED = -1;	{*< Module declines to handle  }
+    DONE = -2;		{*< Module has served the response completely
+                         *  - it's safe to die() with no more output
+			}
+    SUSPENDED = -(3);	{*< Module will handle the remainder of the request.
+                         * The core will never invoke the request again,  }
+
+  {* Returned by the bottom-most filter if no data was written.
+   *  @see ap_pass_brigade().  }
+    AP_NOBODY_WROTE = -100;    
+  {* Returned by the bottom-most filter if no data was read.
+   *  @see ap_get_brigade().  }
+    AP_NOBODY_READ = -101;    
+  {* Returned by any filter if the filter chain encounters an error
+   *  and has already dealt with the error response.    }
+    AP_FILTER_ERROR = -102;    
+
+  {*
+   * @defgroup HTTP_Status HTTP Status Codes
+   * @
+    }
+  {*
+   * The size of the static status_lines array in http_protocol.c for
+   * storing all of the potential response status-lines (a sparse table).
+   * When adding a new code here add it to status_lines as well.
+   * A future version should dynamically generate the apr_table_t at startup.
+    }
+    RESPONSE_CODES =				83;    
+
+    HTTP_CONTINUE =				100;    
+    HTTP_SWITCHING_PROTOCOLS =			101;    
+    HTTP_PROCESSING =				102;    
+    HTTP_OK =					200;    
+    HTTP_CREATED =				201;    
+    HTTP_ACCEPTED =				202;    
+    HTTP_NON_AUTHORITATIVE =			203;    
+    HTTP_NO_CONTENT =				204;    
+    HTTP_RESET_CONTENT =			205;    
+    HTTP_PARTIAL_CONTENT =			206;    
+    HTTP_MULTI_STATUS =				207;    
+    HTTP_ALREADY_REPORTED =			208;    
+    HTTP_IM_USED =				226;    
+    HTTP_MULTIPLE_CHOICES =			300;    
+    HTTP_MOVED_PERMANENTLY =			301;    
+    HTTP_MOVED_TEMPORARILY =			302;    
+    HTTP_SEE_OTHER =				303;    
+    HTTP_NOT_MODIFIED =				304;    
+    HTTP_USE_PROXY =				305;    
+    HTTP_TEMPORARY_REDIRECT =			307;    
+    HTTP_PERMANENT_REDIRECT =			308;    
+    HTTP_BAD_REQUEST =				400;    
+    HTTP_UNAUTHORIZED =				401;    
+    HTTP_PAYMENT_REQUIRED =			402;    
+    HTTP_FORBIDDEN =				403;    
+    HTTP_NOT_FOUND =				404;    
+    HTTP_METHOD_NOT_ALLOWED =			405;    
+    HTTP_NOT_ACCEPTABLE =			406;    
+    HTTP_PROXY_AUTHENTICATION_REQUIRED =	407;    
+    HTTP_REQUEST_TIME_OUT =			408;    
+    HTTP_CONFLICT =				409;    
+    HTTP_GONE =					410;    
+    HTTP_LENGTH_REQUIRED =			411;    
+    HTTP_PRECONDITION_FAILED =			412;    
+    HTTP_REQUEST_ENTITY_TOO_LARGE =		413;    
+    HTTP_REQUEST_URI_TOO_LARGE =		414;    
+    HTTP_UNSUPPORTED_MEDIA_TYPE =		415;    
+    HTTP_RANGE_NOT_SATISFIABLE =		416;    
+    HTTP_EXPECTATION_FAILED =			417;    
+    HTTP_UNPROCESSABLE_ENTITY =			422;    
+    HTTP_LOCKED =				423;    
+    HTTP_FAILED_DEPENDENCY =			424;    
+    HTTP_UPGRADE_REQUIRED =			426;    
+    HTTP_PRECONDITION_REQUIRED =		428;    
+    HTTP_TOO_MANY_REQUESTS =			429;    
+    HTTP_REQUEST_HEADER_FIELDS_TOO_LARGE =	431;    
+    HTTP_INTERNAL_SERVER_ERROR =		500;    
+    HTTP_NOT_IMPLEMENTED =			501;    
+    HTTP_BAD_GATEWAY =				502;    
+    HTTP_SERVICE_UNAVAILABLE =			503;    
+    HTTP_GATEWAY_TIME_OUT =			504;    
+    HTTP_VERSION_NOT_SUPPORTED =		505;    
+    HTTP_VARIANT_ALSO_VARIES =			506;    
+    HTTP_INSUFFICIENT_STORAGE =			507;    
+    HTTP_LOOP_DETECTED =			508;    
+    HTTP_NOT_EXTENDED =				510;    
+    HTTP_NETWORK_AUTHENTICATION_REQUIRED =	511;    
+
+  {* is the status code informational  }
+  function ap_is_HTTP_INFO(x : Integer): Boolean;
+
+  {* is the status code OK ? }
+  { was #define dname(params) para_def_expr }
+  { argument types are unknown }
+  { return type might be wrong }   
+  function ap_is_HTTP_SUCCESS(x : Integer): Boolean;
+
+  {* is the status code a redirect  }
+  { was #define dname(params) para_def_expr }
+  { argument types are unknown }
+  { return type might be wrong }   
+  function ap_is_HTTP_REDIRECT(x : Integer): Boolean;
+
+  {* is the status code a error (client or server)  }
+  { was #define dname(params) para_def_expr }
+  { argument types are unknown }
+  { return type might be wrong }   
+  function ap_is_HTTP_ERROR(x : Integer): Boolean;
+
+  {* is the status code a client error   }
+  { was #define dname(params) para_def_expr }
+  { argument types are unknown }
+  { return type might be wrong }   
+  function ap_is_HTTP_CLIENT_ERROR(x : Integer): Boolean;
+
+  {* is the status code a server error   }
+  { was #define dname(params) para_def_expr }
+  { argument types are unknown }
+  { return type might be wrong }   
+  function ap_is_HTTP_SERVER_ERROR(x : Integer): Boolean;
+
+  {* is the status code a (potentially) valid response code?   }
+  { was #define dname(params) para_def_expr }
+  { argument types are unknown }
+  { return type might be wrong }   
+  function ap_is_HTTP_VALID_RESPONSE(x : Integer): Boolean;
+
+  {* should the status code drop the connection  }
+  function ap_status_drops_connection(x : Integer): Boolean;
+
+    {* @  }
+    {*
+     * @defgroup Methods List of Methods recognized by the server
+     * @ingroup APACHE_CORE_DAEMON
+     * @
+     *
+     * @brief Methods recognized (but not necessarily handled) by the server.
+     *
+     * These constants are used in bit shifting masks of size int, so it is
+     * unsafe to have more methods than bits in an int.  HEAD == M_GET.
+     * This list must be tracked by the list in http_protocol.c in routine
+     * ap_method_name_of().
+     *
+      }
+  const
+    M_GET =			0;      {* RFC 2616: HTTP  }
+    M_PUT =			1;      {  :              }
+    M_POST =			2;      
+    M_DELETE =			3;      
+    M_CONNECT =			4;      
+    M_OPTIONS =			5;      
+    M_TRACE =			6;      {* RFC 2616: HTTP  }
+    M_PATCH =			7;      {* no rfc(!)  ### remove this one?  }
+    M_PROPFIND =		8;      {* RFC 2518: WebDAV  }
+    M_PROPPATCH =		9;      {  :                }
+    M_MKCOL =			10;      
+    M_COPY =			11;      
+    M_MOVE =			12;      
+    M_LOCK =			13;      
+    M_UNLOCK =			14;     {* RFC 2518: WebDAV  }
+    M_VERSION_CONTROL =		15;     {* RFC 3253: WebDAV Versioning  }
+    M_CHECKOUT =		16;     {  :                           }
+    M_UNCHECKOUT =		17;      
+    M_CHECKIN =			18;      
+    M_UPDATE =			19;      
+    M_LABEL =			20;      
+    M_REPORT =			21;      
+    M_MKWORKSPACE =		22;      
+    M_MKACTIVITY =		23;      
+    M_BASELINE_CONTROL =	24;      
+    M_MERGE =			25;      
+    M_INVALID =			26;     {* no valid method  }
+
+    {*
+     * METHODS needs to be equal to the number of bits
+     * we are using for limit masks.
+      }
+    METHODS = 64;      
+    {*
+     * The method mask bit to shift for anding with a bitmask.
+      }
+
+    { was #define dname def_expr }
+    AP_METHOD_BIT = apr_int64_t(1);      
+
+  {* @see ap_method_list_t  }
+  type
+  {*
+   * @struct ap_method_list_t
+   * @brief  Structure for handling HTTP methods.
+   *
+   * Methods known to the server are accessed via a bitmask shortcut;
+   * extension methods are handled by an array.
+    }
+    Pap_method_list_t = ^ap_method_list_t;
+    ap_method_list_t = record
+  {* The bitmask used for known methods  }
+        method_mask : apr_int64_t;
+  {* the array used for extension methods  }
+        method_list : Papr_array_header_t;
+      end;
+
+  {*
+   * @defgroup module_magic Module Magic mime types
+   * @
+    }
+  const
+  {* Magic for mod_cgi[d]  }
+    CGI_MAGIC_TYPE = 'application/x-httpd-cgi';    
+  {* Magic for mod_include  }
+    INCLUDES_MAGIC_TYPE = 'text/x-server-parsed-html';    
+  {* Magic for mod_include  }
+    INCLUDES_MAGIC_TYPE3 = 'text/x-server-parsed-html3';    
+  {* Magic for mod_dir  }
+    DIR_MAGIC_TYPE = 'httpd/unix-directory';    
+  {* @  }
+
+  { Just in case your linefeed isn't the one the other end is expecting.  }
+  const
+  {* linefeed  }
+    LF = 10;    
+  {* carrige return  }
+    CR = 13;    
+  {* carrige return /Line Feed Combo  }
+    CRLF = #015#012;    
+
+  {*
+   * @defgroup values_request_rec_body Possible values for request_rec.read_body
+   * @
+   * Possible values for request_rec.read_body (set by handling module):
+    }
+  {* Send 413 error if message has any body  }
+    REQUEST_NO_BODY =		0;    
+  {* Send 411 error if body without Content-Length  }
+    REQUEST_CHUNKED_ERROR =	1;    
+  {* If chunked, remove the chunks for me.  }
+    REQUEST_CHUNKED_DECHUNK =	2;    
+
+  {* @ // values_request_rec_body  }
+  {*
+   * @defgroup values_request_rec_used_path_info Possible values for request_rec.used_path_info
+   * @ingroup APACHE_CORE_DAEMON
+   * @
+   * Possible values for request_rec.used_path_info:
+    }
+  {* Accept the path_info from the request  }
+    AP_REQ_ACCEPT_PATH_INFO =	0;    
+  {* Return a 404 error if path_info was given  }
+    AP_REQ_REJECT_PATH_INFO =	1;    
+  {* Module may chose to use the given path_info  }
+    AP_REQ_DEFAULT_PATH_INFO =	2;    
+
+  {* @ // values_request_rec_used_path_info  }
+  {
+   * Things which may vary per file-lookup WITHIN a request ---
+   * e.g., state of MIME config.  Basically, the name of an object, info
+   * about the object, and any other info we may ahve which may need to
+   * change as we go poking around looking for it (e.g., overridden by
+   * .htaccess files).
+   *
+   * Note how the default state of almost all these things is properly
+   * zero, so that allocating it with pcalloc does the right thing without
+   * a whole lot of hairy initialization... so long as we are willing to
+   * make the (fairly) portable assumption that the bit pattern of a NULL
+   * pointer is, in fact, zero.
+    }
+  {*
+   * @brief This represents the result of calling htaccess; these are cached for
+   * each request.
+    }
+  type
+    Phtaccess_result = ^htaccess_result;
+    htaccess_result = record
+  {* the directory to which this applies  }
+        dir : Pchar;
+  {* the overrides allowed for the .htaccess file  }
+        override : Integer;
+  {* the override options allowed for the .htaccess file  }
+        override_opts : Integer;
+  {* Table of allowed directives for override  }
+        override_list : Papr_table_t;
+  {* the configuration directives  }
+        htaccess : Pap_conf_vector_t;
+  {* the next one, or NULL if no more; N.B. never change this  }
+        next : Phtaccess_result;
+      end;
+
+  { The following four types define a hierarchy of activities, so that
+   * given a request_rec r you can write r->connection->server->process
+   * to get to the process_rec.  While this reduces substantially the
+   * number of arguments that various hooks require beware that in
+   * threaded versions of the server you must consider multiplexing
+   * issues.   }
+
+//{$include "apr_uri.inc"}
+
+  type
+    {*
+     * @brief A structure that represents one process
+      }
+    Pprocess_rec = ^process_rec;
+    process_rec = record
+    {* Global pool. Cleared upon normal exit  }
+          pool : Papr_pool_t;
+    {* Configuration pool. Cleared upon restart  }
+          pconf : Papr_pool_t;
+    {* The program name used to execute the program  }
+          short_name : PChar;
+    {* The command line arguments  }
+          argv : PChar;
+    {* Number of command line arguments passed to the program  }
+          argc : Integer;
+      end;
+
+ {*
+ * @struct server_addr_rec
+ * @brief  A structure to be used for Per-vhost config
+  }
+  type
+  Pserver_addr_rec = ^server_addr_rec;
+  server_addr_rec = record
+{* The next server in the list  }
+      next : Pserver_addr_rec;
+{* The name given in "<VirtualHost>"  }
+      virthost : Pchar;
+{* The bound address, for this server  }
+      host_addr : Papr_sockaddr_t;
+{* The bound port, for this server  }
+      host_port : apr_port_t;
+    end;
+
+  Pap_logconf = ^ap_logconf;
+  ap_logconf = record
+{* The per-module log levels  }
+      module_levels : ^char;
+{* The log level for this server  }
+      level : longint;
+    end;
+
+{*
+ * @brief A structure to store information for each virtual server
+  }
+  PPserver_rec = ^Pserver_rec;
+  Pserver_rec = ^server_rec;
+  server_rec = record
+{* The process this server is running in  }
+      process : Pprocess_rec;
+{* The next server in the list  }
+      next : Pserver_rec;
+
+{ Log files --- note that transfer log is now in the modules...  }
+
+{* The name of the error log  }
+      error_fname : Pchar;
+{* A file descriptor that references the error log  }
+      error_log : Papr_file_t;
+{* The log level configuration  }
+      log : ap_logconf;
+
+{ Module-specific configuration for server, and defaults...  }
+
+{* Config vector containing pointers to modules' per-server config
+ *  structures.  }
+      module_config : Pap_conf_vector_t;
+{* MIME type info, etc., before we start checking per-directory info  }
+      lookup_defaults : Pap_conf_vector_t;
+{* The name of the server  }
+      defn_name : Pchar;
+{* The line of the config file that the server was defined on  }
+      defn_line_number : dword;
+{* true if this is the virtual server  }
+      is_virtual : char;
+
+{ Information for redirects  }
+
+{* for redirects, etc.  }
+      port : apr_port_t;
+{* The server request scheme for redirect responses  }
+      server_scheme : Pchar;
+
+{ Contact information  }
+
+{* The admin's contact information  }
+      server_admin : Pchar;
+{* The server hostname  }
+      server_hostname : Pchar;
+
+{ Transaction handling  }
+
+{* I haven't got a clue  }
+      addrs : Pserver_addr_rec;
+{* Timeout, as an apr interval, before we give up  }
+      timeout : apr_interval_time_t;
+{* The apr interval we will wait for another request  }
+      keep_alive_timeout : apr_interval_time_t;
+{* Maximum requests per connection  }
+      keep_alive_max : Integer;
+{* Use persistent connections?  }
+      keep_alive : Integer;
+
+{* Normal names for ServerAlias servers  }
+      names : Papr_array_header_t;
+{* Wildcarded names for ServerAlias servers  }
+      wild_names : Papr_array_header_t;
+
+{* Pathname for ServerPath  }
+      path : Pchar;
+{* Length of path  }
+      pathlen : Integer;
+
+{* limit on size of the HTTP request line     }
+      limit_req_line : Integer;
+{* limit on size of any request header field  }
+      limit_req_fieldsize : Integer;
+{* limit on number of request header fields   }
+      limit_req_fields : Integer;
+
+{* Opaque storage location  }
+      context : pointer;
+    end;
+
+
+  {*
+   * @brief Structure to store things which are per connection
+    }
+  type
+    ap_conn_keepalive_e = (AP_CONN_UNKNOWN,AP_CONN_CLOSE,AP_CONN_KEEPALIVE);
+
+    {*
+     * Enumeration of connection states
+     * The two states CONN_STATE_LINGER_NORMAL and CONN_STATE_LINGER_SHORT may
+     * only be set by the MPM. Use CONN_STATE_LINGER outside of the MPM.}
+    conn_state_e = (
+      CONN_STATE_CHECK_REQUEST_LINE_READABLE,
+      CONN_STATE_READ_REQUEST_LINE,
+      CONN_STATE_HANDLER,
+      CONN_STATE_WRITE_COMPLETION,
+      CONN_STATE_SUSPENDED,
+      CONN_STATE_LINGER,	{ connection may be closed with lingering  }
+      CONN_STATE_LINGER_NORMAL,	{ MPM has started lingering close with normal timeout  }
+      CONN_STATE_LINGER_SHORT);	{ MPM has started lingering close with short timeout  }
+
+    {*
+     * @brief A structure to contain connection state information}
+    Pconn_state_t = ^conn_state_t;
+    conn_state_t = record
+        {* Current state of the connection  }
+        state : conn_state_e;
+      end;
+
+    Pconn_rec = ^conn_rec;
+    conn_rec = record
+  {* Pool associated with this connection  }
+        pool : Papr_pool_t;
+  {* Physical vhost this conn came in on  }
+        base_server : Pserver_rec;
+  {* used by http_vhost.c  }
+        vhost_lookup_data : pointer;
+  { Information about the connection itself  }
+  {* local address  }
+        local_addr : Papr_sockaddr_t;
+  {* remote address; this is the end-point of the next hop, for the address
+   *  of the request creator, see useragent_addr in request_rec
+   }
+        remote_addr {client_addr} : Papr_sockaddr_t; //fpc -> renamed to stay compatible with older apache versions and older fcl-web
+  {* Client's IP address; this is the end-point of the next hop, for the
+   *  IP of the request creator, see useragent_ip in request_rec
+   }
+        remote_ip {client_ip} : Pchar;               //fpc -> renamed to stay compatible with older apache versions and older fcl-web
+  {* Client's DNS name, if known.  NULL if DNS hasn't been checked,
+   *  "" if it has and no address was found.  N.B. Only access this though
+   * get_remote_host()  }
+        remote_host : Pchar;
+  {* Only ever set if doing rfc1413 lookups.  N.B. Only access this through
+   *  get_remote_logname()  }
+        remote_logname : Pchar;
+  {* server IP address  }
+        local_ip : Pchar;
+  {* used for ap_get_server_name when UseCanonicalName is set to DNS
+   *  (ignores setting of HostnameLookups)  }
+        local_host : Pchar;
+  {* ID of this connection; unique at any point in time  }
+        id : clong;
+  {* Config vector containing pointers to connections per-server
+   *  config structures.  }
+        conn_config : Pap_conf_vector_t;
+  {* Notes on *this* connection: send note from one module to
+   *  another. must remain valid for all requests on this conn  }
+        notes : Papr_table_t;
+  {* A list of input filters to be used for this connection  }
+        input_filters : Pap_filter_t;
+  {* A list of output filters to be used for this connection  }
+        output_filters : Pap_filter_t;
+  {* handle to scoreboard information for this connection  }
+        sbh : pointer;
+  {* The bucket allocator to use for all bucket/brigade creations  }
+        bucket_alloc : Papr_bucket_alloc_t;
+  {* The current state of this connection; may be NULL if not used by MPM  }
+        cs : Pconn_state_t;
+  {* Is there data pending in the input filters?  }
+        data_in_input_filters : cint;
+  {* Is there data pending in the output filters?  }
+        data_in_output_filters : cint;
+  {* Are there any filters that clogg/buffer the input stream, breaking
+   *  the event mpm.
+   }
+        clogging_input_filters: cint;
+  {* have we done double-reverse DNS? -1 yes/failure, 0 not yet,
+   *  1 yes/success  }
+        double_reverse: Cardinal;
+  {* Are we still talking?  }
+        aborted : Cardinal;
+  {* Are we going to keep the connection alive for another request?
+   * @see ap_conn_keepalive_e  }
+        keepalive : ap_conn_keepalive_e;
+  {* How many times have we used it?  }
+        keepalives : Integer;
+  {* Optional connection log level configuration. May point to a server or
+   *  per_dir config, i.e. must be copied before modifying  }
+        log : Pap_logconf;
+  {* Id to identify this connection in error log. Set when the first
+   *  error log entry for this connection is generated.
+   }
+        log_id : Pchar;
+  {* This points to the current thread being used to process this request,
+   * over the lifetime of a request, the value may change. Users of the connection
+   * record should not rely upon it staying the same between calls that invole
+   * the MPM.
+   }
+//{$if APR_HAS_THREADS}
+//        current_thread : Papr_thread_t;
+//{$endif}
+      end;
+
+  {*
+   * @brief A structure that represents the current request
+    }
+    Prequest_rec = ^request_rec;
+    request_rec = record
+  {* The pool associated with the request  }
+        pool : Papr_pool_t;
+  {* The connection to the client  }
+        connection : Pconn_rec;
+  {* The virtual host for this request  }
+        server : Pserver_rec;
+  {* Pointer to the redirected request if this is an external redirect  }
+        next : Prequest_rec;
+  {* Pointer to the previous request if this is an internal redirect  }
+        prev : Prequest_rec;
+  {* Pointer to the main request if this is a sub-request (see http_request.h)  }
+        main : Prequest_rec;
+
+  { Info about the request itself... we begin with stuff that only protocol.c should ever touch...  }
+  {* First line of request  }
+        the_request : Pchar;
+  {* HTTP/0.9, "simple" request (e.g. GET /foo\n w/no headers)  }
+        assbackwards : Integer;
+  {* A proxy request (calculated during post_read_request/translate_name)
+   *  possible values PROXYREQ_NONE, PROXYREQ_PROXY, PROXYREQ_REVERSE,
+   *                  PROXYREQ_RESPONSE
+   }
+        proxyreq : Integer;
+  {* HEAD request, as opposed to GET  }
+        header_only : Integer;
+  {* Protocol version number of protocol; 1.1 = 1001  }
+        proto_num : Integer;
+  {* Protocol string, as given to us, or HTTP/0.9  }
+        protocol : Pchar;
+  {* Host, as set by full URI or Host:  }
+        hostname : Pchar;
+  {* Time when the request started  }
+        request_time : apr_time_t;
+  {* Status line, if set by script  }
+        status_line : Pchar;
+  {* Status line  }
+        status : Integer;
+  { Request method, two ways; also, protocol, etc..  Outside of protocol.c,
+       * look, but don't touch.
+        }
+  {* M_GET, M_POST, etc.  }
+        method_number : Integer;
+  {* Request method (eg. GET, HEAD, POST, etc.)  }
+        method : Pchar;
+
+  {*
+   *  'allowed' is a bitvector of the allowed methods.
+   *
+   *  A handler must ensure that the request method is one that
+   *  it is capable of handling.  Generally modules should DECLINE
+   *  any request methods they do not handle.  Prior to aborting the
+   *  handler like this the handler should set r->allowed to the list
+   *  of methods that it is willing to handle.  This bitvector is used
+   *  to construct the "Allow:" header required for OPTIONS requests,
+   *  and HTTP_METHOD_NOT_ALLOWED and HTTP_NOT_IMPLEMENTED status codes.
+   *
+   *  Since the default_handler deals with OPTIONS, all modules can
+   *  usually decline to deal with OPTIONS.  TRACE is always allowed,
+   *  modules don't need to set it explicitly.
+   *
+   *  Since the default_handler will always handle a GET, a
+   *  module which does *not* implement GET should probably return
+   *  HTTP_METHOD_NOT_ALLOWED.  Unfortunately this means that a Script GET
+   *  handler can't be installed by mod_actions.
+   }
+        allowed : apr_int64_t;
+  {* Array of extension methods  }
+        allowed_xmethods : Papr_array_header_t;
+  {* List of allowed methods  }
+        allowed_methods : Pap_method_list_t;
+  {* byte count in stream is for body  }
+        sent_bodyct : apr_off_t;
+  {* body byte count, for easy access  }
+        bytes_sent : apr_off_t;
+  {* Last modified time of the requested resource  }
+        mtime : apr_time_t;
+  { HTTP/1.1 connection-level features  }
+  {* The Range: header  }
+        range : Pchar;
+  {* The "real" content length  }
+        clength : apr_off_t;
+  {* sending chunked transfer-coding  }
+        chunked : Integer;
+  {* Method for reading the request body
+   * (eg. REQUEST_CHUNKED_ERROR, REQUEST_NO_BODY,
+   *  REQUEST_CHUNKED_DECHUNK, etc...)  }
+        read_body : Integer;
+  {* reading chunked transfer-coding  }
+        read_chunked : Integer;
+  {* is client waiting for a 100 response?  }
+        expecting_100 : Cardinal;
+  {* The optional kept body of the request.  }
+        kept_body : Papr_bucket_brigade;
+  {* For ap_body_to_table(): parsed body  }
+  {  XXX: ap_body_to_table has been removed. Remove body_table too or
+   * XXX: keep it to reintroduce ap_body_to_table without major bump?  }
+        body_table : Papr_table_t;
+  {* Remaining bytes left to read from the request body  }
+        remaining : apr_off_t;
+  {* Number of bytes that have been read  from the request body  }
+        read_length : apr_off_t;
+
+  { MIME header environments, in and out.  Also, an array containing
+  * environment variables to be passed to subprocesses, so people can
+  * write modules to add to that environment.
+  *
+  * The difference between headers_out and err_headers_out is that the
+  * latter are printed even on error, and persist across internal redirects
+  * (so the headers printed for ErrorDocument handlers will have them).
+  *
+  * The 'notes' apr_table_t is for notes from one module to another, with no
+  * other set purpose in mind...
+  }
+  {* MIME header environment from the request  }
+        headers_in : Papr_table_t;
+  {* MIME header environment for the response  }
+        headers_out : Papr_table_t;
+  {* MIME header environment for the response, printed even on errors and
+   * persist across internal redirects  }
+        err_headers_out : Papr_table_t;
+  {* Array of environment variables to be used for sub processes  }
+        subprocess_env : Papr_table_t;
+  {* Notes from one module to another  }
+        notes : Papr_table_t;
+
+  { content_type, handler, content_encoding, and all content_languages
+  * MUST be lowercased strings.  They may be pointers to static strings;
+  * they should not be modified in place.
+  }
+  {* The content-type for the current request  }
+        content_type : Pchar;	{ Break these out --- we dispatch on 'em  }
+  {* The handler string that we use to call a handler function  }
+        handler : Pchar;	{ What we *really* dispatch on  }
+  {* How to encode the data  }
+        content_encoding : Pchar;
+  {* Array of strings representing the content languages  }
+        content_languages : Papr_array_header_t;
+  {* variant list validator (if negotiated)  }
+        vlist_validator : Pchar;
+  {* If an authentication check was made, this gets set to the user name.  }
+        user : Pchar;
+  {* If an authentication check was made, this gets set to the auth type.  }
+        ap_auth_type : Pchar;
+
+  { What object is being requested (either directly, or via include
+       * or content-negotiation mapping).
+        }
+  {* The URI without any parsing performed  }
+        unparsed_uri : Pchar;
+  {* The path portion of the URI, or "/" if no path provided  }
+        uri : Pchar;
+  {* The filename on disk corresponding to this response  }
+        filename : Pchar;
+  { XXX: What does this mean? Please define "canonicalize" -aaron  }
+  {* The true filename, we canonicalize r->filename if these don't match  }
+        canonical_filename : Pchar;
+  {* The PATH_INFO extracted from this request  }
+        path_info : Pchar;
+  {* The QUERY_ARGS extracted from this request  }
+        args : Pchar;
+
+  {*
+   * Flag for the handler to accept or reject path_info on
+   * the current request.  All modules should respect the
+   * AP_REQ_ACCEPT_PATH_INFO and AP_REQ_REJECT_PATH_INFO
+   * values, while AP_REQ_DEFAULT_PATH_INFO indicates they
+   * may follow existing conventions.  This is set to the
+   * user's preference upon HOOK_VERY_FIRST of the fixups.
+   }
+        used_path_info : Integer;
+  {* A flag to determine if the eos bucket has been sent yet  }
+        eos_sent : Integer;
+
+  { Various other config info which may change with .htaccess files
+  * These are config vectors, with one void* pointer for each module
+  * (the thing pointed to being the module's business).
+  }
+  {* Options set in config files, etc.  }
+        per_dir_config : Pap_conf_vector_t;
+  {* Notes on *this* request  }
+        request_config : Pap_conf_vector_t;
+  {* Optional request log level configuration. Will usually point
+   *  to a server or per_dir config, i.e. must be copied before
+   *  modifying  }
+        log : Pap_logconf;
+  {* Id to identify request in access and error log. Set when the first
+   *  error log entry for this request is generated.
+   }
+        log_id : Pchar;
+  {*
+   * A linked list of the .htaccess configuration directives
+   * accessed by this request.
+   * N.B. always add to the head of the list, _never_ to the end.
+   * that way, a sub request's list can (temporarily) point to a parent's list
+  }
+        htaccess : Phtaccess_result;
+  {* A list of output filters to be used for this request  }
+        output_filters : Pap_filter_t;
+  {* A list of input filters to be used for this request  }
+        input_filters : Pap_filter_t;
+  {* A list of protocol level output filters to be used for this
+   *  request  }
+        proto_output_filters : Pap_filter_t;
+  {* A list of protocol level input filters to be used for this
+   *  request  }
+        proto_input_filters : Pap_filter_t;
+  {* This response can not be cached  }
+        no_cache : Integer;
+  {* There is no local copy of this response  }
+        no_local_copy : Integer;
+  {* Mutex protect callbacks registered with ap_mpm_register_timed_callback
+   * from being run before the original handler finishes running
+   }
+        invoke_mtx : Papr_thread_mutex_t;
+  {* A struct containing the components of URI  }
+        parsed_uri : apr_uri_t;
+  {*  finfo.protection (st_mode) set to zero if no such file  }
+        finfo : apr_finfo_t;
+  {* remote address information from conn_rec, can be overridden if
+   * necessary by a module.
+   * This is the address that originated the request.
+   }
+        useragent_addr : Papr_sockaddr_t;
+        useragent_ip : Pchar;
+      end;
+
+  {*
+   * @defgroup ProxyReq Proxy request types
+   *
+   * Possible values of request_rec->proxyreq. A request could be normal,
+   *  proxied or reverse proxied. Normally proxied and reverse proxied are
+   *  grouped together as just "proxied", but sometimes it's necessary to
+   *  tell the difference between the two, such as for authentication.
+   * @
+    }
+  
+
+  const
+    PROXYREQ_NONE =	0;{*< No proxy  }
+    PROXYREQ_PROXY =	1;{*< Standard proxy  }
+    PROXYREQ_REVERSE =	2;{*< Reverse proxy  }
+    PROXYREQ_RESPONSE =	3;{*< Origin response  }
+  { @  }
+
+  {*
+   * @brief Enumeration of connection keepalive options
+   }
+//  type  {moved up}
+//    ap_conn_keepalive_e = (AP_CONN_UNKNOWN,AP_CONN_CLOSE,AP_CONN_KEEPALIVE);
+
+  { Per-vhost config...  }
+  {*
+   * The address 255.255.255.255, when used as a virtualhost address,
+   * will become the "default" server when the ip doesn't match other vhosts.
+    }
+  const
+    DEFAULT_VHOST_ADDR = $ffffffff;    
+
+  {*
+   * Get the context_document_root for a request. This is a generalization of
+   * the document root, which is too limited in the presence of mappers like
+   * mod_userdir and mod_alias. The context_document_root is the directory
+   * on disk that maps to the context_prefix URI prefix.
+   * @param r The request
+   * @note For resources that do not map to the file system or for very complex
+   * mappings, this information may still be wrong.
+    }
+function ap_context_document_root(r: Prequest_rec): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_context_document_root' + LibSuff4;
+
+  {*
+   * Get the context_prefix for a request. The context_prefix URI prefix
+   * maps to the context_document_root on disk.
+   * @param r The request
+    }
+function ap_context_prefix(r: Prequest_rec): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_context_prefix' + LibSuff4;
+
+  {* Set context_prefix and context_document_root for a request.
+   * @param r The request
+   * @param prefix the URI prefix, without trailing slash
+   * @param document_root the corresponding directory on disk, without trailing
+   * slash
+   * @note If one of prefix of document_root is NULL, the corrsponding
+   * property will not be changed.
+    }
+procedure ap_set_context_info(r: Prequest_rec; const prefix, document_root: PChar);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_set_context_info' + LibSuff12;
+
+  {* Set per-request document root. This is for mass virtual hosting modules
+   * that want to provide the correct DOCUMENT_ROOT value to scripts.
+   * @param r The request
+   * @param document_root the document root for the request.
+    }
+procedure ap_set_document_root(r: Prequest_rec; const document_root: PChar);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_set_document_root' + LibSuff8;
+
+  {*
+   * Examine a field value (such as a media-/content-type) string and return
+   * it sans any parameters; e.g., strip off any ';charset=foo' and the like.
+   * @param p Pool to allocate memory from
+   * @param intype The field to examine
+   * @return A copy of the field minus any parameters
+    }
+function ap_field_noparam(p: Papr_pool_t; const intype: PChar): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_field_noparam' + LibSuff8;
+
+  {*
+   * Convert a time from an integer into a string in a specified format
+   * @param p The pool to allocate memory from
+   * @param t The time to convert
+   * @param fmt The format to use for the conversion
+   * @param gmt Convert the time for GMT?
+   * @return The string that represents the specified time
+    }
+function ap_ht_time(p: Papr_pool_t; t: apr_time_t; const fmt: PChar; gmt: Integer): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_ht_time' + LibSuff20;
+
+
+  { String handling. The *_nc variants allow you to use non-const char **s as
+     arguments (unfortunately C won't automatically convert a char ** to a const
+     char **)  }
+  {*
+   * Get the characters until the first occurance of a specified character
+   * @param p The pool to allocate memory from
+   * @param line The string to get the characters from
+   * @param stop The character to stop at
+   * @return A copy of the characters up to the first stop character
+    }
+function ap_getword(p: Papr_pool_t; const line: PPChar; stop: Char): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_getword' + LibSuff12;
+
+  {*
+   * Get the characters until the first occurance of a specified character
+   * @param p The pool to allocate memory from
+   * @param line The string to get the characters from
+   * @param stop The character to stop at
+   * @return A copy of the characters up to the first stop character
+   * @note This is the same as ap_getword(), except it doesn't use const char **.
+    }
+function ap_getword_nc(p: Papr_pool_t; line: PPChar; stop: Char): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_getword_nc' + LibSuff12;
+
+  {*
+   * Get the first word from a given string.  A word is defined as all characters
+   * up to the first whitespace.
+   * @param p The pool to allocate memory from
+   * @param line The string to traverse
+   * @return The first word in the line
+    }
+function ap_getword_white(p: Papr_pool_t; const line: PPChar): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_getword_white' + LibSuff8;
+
+  {*
+   * Get the first word from a given string.  A word is defined as all characters
+   * up to the first whitespace.
+   * @param p The pool to allocate memory from
+   * @param line The string to traverse
+   * @return The first word in the line
+   * @note The same as ap_getword_white(), except it doesn't use const char**
+    }
+function ap_getword_white_nc(p: Papr_pool_t; line: PPChar): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_getword_white_nc' + LibSuff8;
+
+  {*
+   * Get all characters from the first occurance of @a stop to the first "\0"
+   * @param p The pool to allocate memory from
+   * @param line The line to traverse
+   * @param stop The character to start at
+   * @return A copy of all caracters after the first occurance of the specified
+   *         character
+    }
+function ap_getword_nulls(p: Papr_pool_t; const line: PPChar; stop: Char): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_getword_nulls' + LibSuff12;
+
+  {*
+   * Get all characters from the first occurance of @a stop to the first "\0"
+   * @param p The pool to allocate memory from
+   * @param line The line to traverse
+   * @param stop The character to start at
+   * @return A copy of all caracters after the first occurance of the specified
+   *         character
+   * @note The same as ap_getword_nulls(), except it doesn't use const char **.
+    }
+function ap_getword_nulls_nc(p: Papr_pool_t; line: PPChar; stop: Char): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_getword_nulls_nc' + LibSuff12;
+
+  {*
+   * Get the second word in the string paying attention to quoting
+   * @param p The pool to allocate from
+   * @param line The line to traverse
+   * @return A copy of the string
+    }
+function ap_getword_conf(p: Papr_pool_t; const line: PPChar): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_getword_conf' + LibSuff8;
+
+  {*
+   * Get the second word in the string paying attention to quoting
+   * @param p The pool to allocate from
+   * @param line The line to traverse
+   * @return A copy of the string
+   * @note The same as ap_getword_conf(), except it doesn't use const char **.
+    }
+function ap_getword_conf_nc(p: Papr_pool_t; line: PPChar): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_getword_conf_nc' + LibSuff8;
+
+  {*
+   * Check a string for any config define or environment variable construct
+   * and replace each of them by the value of that variable, if it exists.
+   * The default syntax of the constructs is $ENV but can be changed by
+   * setting the define::* config defines. If the variable does not exist,
+   * leave the $ENV construct alone but print a warning.
+   * @param p The pool to allocate from
+   * @param word The string to check
+   * @return The string with the replaced environment variables
+    }
+//AP_DECLARE(const char *) ap_resolve_env(apr_pool_t *p, const char * word);
+function ap_resolve_env(p: Papr_pool_t; const word_: PChar): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_resolve_env' + LibSuff8;
+
+  {*
+   * Size an HTTP header field list item, as separated by a comma.
+   * @param field The field to size
+   * @param len The length of the field
+   * @return The return value is a pointer to the beginning of the non-empty
+   * list item within the original string (or NULL if there is none) and the
+   * address of field is shifted to the next non-comma, non-whitespace
+   * character.  len is the length of the item excluding any beginning whitespace.
+    }
+//AP_DECLARE(const char *) ap_size_list_item(const char **field, int *len);
+function ap_size_list_item(const field: PPChar; len: PInteger): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_size_list_item' + LibSuff8;
+
+  {*
+   * Retrieve an HTTP header field list item, as separated by a comma,
+   * while stripping insignificant whitespace and lowercasing anything not in
+   * a quoted string or comment.
+   * @param p The pool to allocate from
+   * @param field The field to retrieve
+   * @return The return value is a new string containing the converted list
+   *         item (or NULL if none) and the address pointed to by field is
+   *         shifted to the next non-comma, non-whitespace.
+    }
+function ap_get_list_item(p: Papr_pool_t; const field: PPChar): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_get_list_item' + LibSuff8;
+
+  {*
+   * Find an item in canonical form (lowercase, no extra spaces) within
+   * an HTTP field value list.
+   * @param p The pool to allocate from
+   * @param line The field value list to search
+   * @param tok The token to search for
+   * @return 1 if found, 0 if not found.
+    }
+function ap_find_list_item(p: Papr_pool_t; const line, tok: PChar): Integer;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_find_list_item' + LibSuff12;
+
+  {*
+   * Retrieve a token, spacing over it and adjusting the pointer to
+   * the first non-white byte afterwards.  Note that these tokens
+   * are delimited by semis and commas and can also be delimited
+   * by whitespace at the caller's option.
+   * @param p The pool to allocate from
+   * @param accept_line The line to retrieve the token from (adjusted afterwards)
+   * @param accept_white Is it delimited by whitespace
+   * @return the token
+    }
+function ap_get_token(p: Papr_pool_t; const accept_line: PPChar; accept_white: Integer): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_get_token' + LibSuff12;
+
+  {*
+   * Find http tokens, see the definition of token from RFC2068
+   * @param p The pool to allocate from
+   * @param line The line to find the token
+   * @param tok The token to find
+   * @return 1 if the token is found, 0 otherwise
+    }
+function ap_find_token(p: Papr_pool_t; const line, tok: PChar): Integer;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_find_token' + LibSuff12;
+
+  {*
+   * find http tokens from the end of the line
+   * @param p The pool to allocate from
+   * @param line The line to find the token
+   * @param tok The token to find
+   * @return 1 if the token is found, 0 otherwise
+    }
+function ap_find_last_token(p: Papr_pool_t; const line, tok: PChar): Integer;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_find_last_token' + LibSuff12;
+
+  {*
+   * Check for an Absolute URI syntax
+   * @param u The string to check
+   * @return 1 if URI, 0 otherwise
+    }
+function ap_is_url(const u: PChar): Integer;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_is_url' + LibSuff4;
+
+  {*
+   * Unescape a string
+   * @param url The string to unescape
+   * @return 0 on success, non-zero otherwise
+    }
+function ap_unescape_all(url: PChar): Integer;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_unescape_all' + LibSuff4;
+
+  {*
+   * Unescape a URL
+   * @param url The url to unescape
+   * @return 0 on success, non-zero otherwise
+    }
+function ap_unescape_url(url: PChar): Integer;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_unescape_url' + LibSuff4;
+
+  {*
+   * Unescape a URL, but leaving %2f (slashes) escaped
+   * @param url The url to unescape
+   * @param decode_slashes Whether or not slashes should be decoded
+   * @return 0 on success, non-zero otherwise
+    }
+function ap_unescape_url_keep2f(url: PChar; decode_slashes: Integer): Integer;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_unescape_url_keep2f' + LibSuff8;
+
+  {*
+   * Unescape an application/x-www-form-urlencoded string
+   * @param query The query to unescape
+   * @return 0 on success, non-zero otherwise
+    }
+function ap_unescape_urlencoded(query: PChar): Integer;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_unescape_urlencoded' + LibSuff4;
+
+  {*
+   * Convert all double slashes to single slashes
+   * @param name The string to convert
+    }
+procedure ap_no2slash(name: PChar);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_no2slash' + LibSuff4;
+
+  {*
+   * Remove all ./ and xx/../ substrings from a file name. Also remove
+   * any leading ../ or /../ substrings.
+   * @param name the file name to parse
+    }
+procedure ap_getparents(name: PChar);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_getparents' + LibSuff4;
+
+  {*
+   * Escape a path segment, as defined in RFC 1808
+   * @param p The pool to allocate from
+   * @param s The path to convert
+   * @return The converted URL
+    }
+function ap_escape_path_segment(p: Papr_pool_t; const s: PChar): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_escape_path_segment' + LibSuff8;
+
+  {*
+   * Escape a path segment, as defined in RFC 1808, to a preallocated buffer.
+   * @param c The preallocated buffer to write to
+   * @param s The path to convert
+   * @return The converted URL (c)
+    }
+function ap_escape_path_segment_buffer(c: PChar; const s: PChar): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_escape_path_segment_buffer' + LibSuff8;
+
+  {*
+   * convert an OS path to a URL in an OS dependant way.
+   * @param p The pool to allocate from
+   * @param path The path to convert
+   * @param partial if set, assume that the path will be appended to something
+   *        with a '/' in it (and thus does not prefix "./")
+   * @return The converted URL
+    }
+function ap_os_escape_path(p: Papr_pool_t; const path: PChar; partial: Integer): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_os_escape_path' + LibSuff12;
+
+
+  {* @see ap_os_escape_path  }
+  { was #define dname(params) para_def_expr }
+  { argument types are unknown }
+  { return type might be wrong }   
+//#define ap_escape_uri(ppool,path) ap_os_escape_path(ppool,path,1)
+function ap_escape_uri(ppool: Papr_pool_t; const path: PChar) : PChar;  
+
+{*
+ * Escape a string as application/x-www-form-urlencoded
+ * @param p The pool to allocate from
+ * @param s The path to convert
+ * @return The converted URL
+  }
+function ap_escape_urlencoded(p: Papr_pool_t; const s: PChar): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_escape_urlencoded' + LibSuff8;
+
+{*
+ * Escape a string as application/x-www-form-urlencoded, to a preallocated buffer
+ * @param c The preallocated buffer to write to
+ * @param s The path to convert
+ * @return The converted URL (c)
+  }
+function ap_escape_urlencoded_buffer(c: PChar; const s: PChar): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_escape_urlencoded_buffer' + LibSuff8;
+
+{*
+ * Escape an html string
+ * @param p The pool to allocate from
+ * @param s The html to escape
+ * @return The escaped string
+  }
+//#define ap_escape_html(p,s) ap_escape_html2(p,s,0)
+function ap_escape_html(p: Papr_pool_t; const s: PChar) : PChar;
+
+{*
+ * Escape an html string
+ * @param p The pool to allocate from
+ * @param s The html to escape
+ * @param toasc Whether to escape all non-ASCII chars to \&\#nnn;
+ * @return The escaped string
+  }
+function ap_escape_html2(p: Papr_pool_t; const s: PChar; toasc: Integer): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_escape_html2' + LibSuff12;
+
+{*
+ * Escape a string for logging
+ * @param p The pool to allocate from
+ * @param str The string to escape
+ * @return The escaped string
+  }
+function ap_escape_logitem(p: Papr_pool_t; const str: PChar): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_escape_logitem' + LibSuff8;
+
+{*
+ * Escape a string for logging into the error log (without a pool)
+ * @param dest The buffer to write to
+ * @param source The string to escape
+ * @param buflen The buffer size for the escaped string (including "\0")
+ * @return The len of the escaped string (always < maxlen)
+  }
+function ap_escape_errorlog_item(dest: PChar; const source: PChar;
+ buflen: apr_size_t): apr_size_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_escape_errorlog_item' + LibSuff12;
+
+{*
+ * Construct a full hostname
+ * @param p The pool to allocate from
+ * @param hostname The hostname of the server
+ * @param port The port the server is running on
+ * @param r The current request
+ * @return The server's hostname
+  }
+function ap_construct_server(p: Papr_pool_t; const hostname: PChar;
+ port: apr_port_t; const r: Prequest_rec): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_construct_server' + LibSuff16;
+
+{*
+ * Escape a shell command
+ * @param p The pool to allocate from
+ * @param s The command to escape
+ * @return The escaped shell command
+  }
+function ap_escape_shell_cmd(p: Papr_pool_t; const s: PChar): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_escape_shell_cmd' + LibSuff8;
+
+{*
+ * Count the number of directories in a path
+ * @param path The path to count
+ * @return The number of directories
+  }
+function ap_count_dirs(const path: PChar): Integer;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_count_dirs' + LibSuff4;
+
+{*
+ * Copy at most @a n leading directories of @a s into @a d. @a d
+ * should be at least as large as @a s plus 1 extra byte
+ *
+ * @param d The location to copy to
+ * @param s The location to copy from
+ * @param n The number of directories to copy
+ * @return value is the ever useful pointer to the trailing "\0" of d
+ * @note on platforms with drive letters, n = 0 returns the "/" root,
+ * whereas n = 1 returns the "d:/" root.  On all other platforms, n = 0
+ * returns the empty string.   }
+function ap_make_dirstr_prefix(d: PChar; const s: PChar; n: Integer): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_make_dirstr_prefix' + LibSuff12;
+
+{*
+ * Return the parent directory name (including trailing /) of the file
+ * @a s
+ * @param p The pool to allocate from
+ * @param s The file to get the parent of
+ * @return A copy of the file's parent directory
+  }
+function ap_make_dirstr_parent(p: Papr_pool_t; const s: PChar): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_make_dirstr_parent' + LibSuff8;
+
+{*
+ * Given a directory and filename, create a single path from them.  This
+ * function is smart enough to ensure that there is a single '/' between the
+ * directory and file names
+ * @param a The pool to allocate from
+ * @param dir The directory name
+ * @param f The filename
+ * @return A copy of the full path
+ * @note Never consider using this function if you are dealing with filesystem
+ * names that need to remain canonical, unless you are merging an apr_dir_read
+ * path and returned filename.  Otherwise, the result is not canonical.
+  }
+function ap_make_full_path(a: Papr_pool_t; const dir, f: PChar): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_make_full_path' + LibSuff12;
+
+{*
+ * Test if the given path has an an absolute path.
+ * @param p The pool to allocate from
+ * @param dir The directory name
+ * @note The converse is not necessarily true, some OS's (Win32/OS2/Netware) have
+ * multiple forms of absolute paths.  This only reports if the path is absolute
+ * in a canonical sense.
+  }
+function ap_os_is_path_absolute(p: Papr_pool_t; const dir: PChar): Integer;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_os_is_path_absolute' + LibSuff8;
+
+{*
+ * Does the provided string contain wildcard characters?  This is useful
+ * for determining if the string should be passed to strcmp_match or to strcmp.
+ * The only wildcard characters recognized are '?' and '*'
+ * @param str The string to check
+ * @return 1 if the string has wildcards, 0 otherwise
+  }
+function ap_is_matchexp(const str: PChar): Integer;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_is_matchexp' + LibSuff4;
+
+{*
+ * Determine if a string matches a patterm containing the wildcards '?' or '*'
+ * @param str The string to check
+ * @param expected The pattern to match against
+ * @return 0 if the two strings match, 1 otherwise
+  }
+function ap_strcmp_match(const str, expected: PChar): Integer;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_strcmp_match' + LibSuff8;
+
+{*
+ * Determine if a string matches a patterm containing the wildcards '?' or '*',
+ * ignoring case
+ * @param str The string to check
+ * @param expected The pattern to match against
+ * @return 0 if the two strings match, 1 otherwise
+  }
+function ap_strcasecmp_match(const str, expected: PChar): Integer;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_strcasecmp_match' + LibSuff8;
+
+{*
+ * Find the first occurrence of the substring s2 in s1, regardless of case
+ * @param s1 The string to search
+ * @param s2 The substring to search for
+ * @return A pointer to the beginning of the substring
+ * @remark See apr_strmatch() for a faster alternative
+  }
+function ap_strcasestr(const s1, s2: PChar): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_strcasestr' + LibSuff8;
+
+{*
+ * Return a pointer to the location inside of bigstring immediately after prefix
+ * @param bigstring The input string
+ * @param prefix The prefix to strip away
+ * @return A pointer relative to bigstring after prefix
+  }
+function ap_stripprefix(const bigstring, prefix: PChar): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_stripprefix' + LibSuff8;
+
+{*
+ * Decode a base64 encoded string into memory allocated from a pool
+ * @param p The pool to allocate from
+ * @param bufcoded The encoded string
+ * @return The decoded string
+  }
+function ap_pbase64decode(p: Papr_pool_t; const bufcoded: PChar): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_pbase64decode' + LibSuff8;
+
+{*
+ * Encode a string into memory allocated from a pool in base 64 format
+ * @param p The pool to allocate from
+ * @param string The plaintext string
+ * @return The encoded string
+  }
+//AP_DECLARE(char *) ap_pbase64encode(apr_pool_t *p, char *string);
+function ap_pbase64encode(p: Papr_pool_t; string_: PChar): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_pbase64encode' + LibSuff8;
+
+{*
+ * Compile a regular expression to be used later. The regex is freed when
+ * the pool is destroyed.
+ * @param p The pool to allocate from
+ * @param pattern the regular expression to compile
+ * @param cflags The bitwise or of one or more of the following:
+ *   @li REG_EXTENDED - Use POSIX extended Regular Expressions
+ *   @li REG_ICASE    - Ignore case
+ *   @li REG_NOSUB    - Support for substring addressing of matches
+ *       not required
+ *   @li REG_NEWLINE  - Match-any-character operators don't match new-line
+ * @return The compiled regular expression
+  }
+function ap_pregcomp(p: Papr_pool_t; const pattern: PChar; cflags: Integer): Pap_regex_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_pregcomp' + LibSuff12;
+
+{*
+ * Free the memory associated with a compiled regular expression
+ * @param p The pool the regex was allocated from
+ * @param reg The regular expression to free
+ * @note This function is only necessary if the regex should be cleaned
+ * up before the pool
+  }
+procedure ap_pregfree(p: Papr_pool_t; reg: Pap_regex_t);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_pregfree' + LibSuff8;
+
+{*
+ * After performing a successful regex match, you may use this function to
+ * perform a series of string substitutions based on subexpressions that were
+ * matched during the call to ap_regexec. This function is limited to
+ * result strings of 64K. Consider using ap_pregsub_ex() instead.
+ * @param p The pool to allocate from
+ * @param input An arbitrary string containing $1 through $9.  These are
+ *              replaced with the corresponding matched sub-expressions
+ * @param source The string that was originally matched to the regex
+ * @param nmatch the nmatch returned from ap_pregex
+ * @param pmatch the pmatch array returned from ap_pregex
+ * @return The substituted string, or NULL on error
+  }
+//AP_DECLARE(char *) ap_pregsub(apr_pool_t *p, const char *input,
+//                              const char *source, apr_size_t nmatch,
+//                              ap_regmatch_t pmatch[]);
+function ap_pregsub(p: Papr_pool_t; const input, source: PChar;
+ nmatch: apr_size_t; pmatch: array of ap_regmatch_t): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_pregsub' + LibSuff20;
+
+{*
+ * After performing a successful regex match, you may use this function to
+ * perform a series of string substitutions based on subexpressions that were
+ * matched during the call to ap_regexec
+ * @param p The pool to allocate from
+ * @param result where to store the result, will be set to NULL on error
+ * @param input An arbitrary string containing $1 through $9.  These are
+ *              replaced with the corresponding matched sub-expressions
+ * @param source The string that was originally matched to the regex
+ * @param nmatch the nmatch returned from ap_pregex
+ * @param pmatch the pmatch array returned from ap_pregex
+ * @param maxlen the maximum string length to return, 0 for unlimited
+ * @return The substituted string, or NULL on error
+  }
+//AP_DECLARE(apr_status_t) ap_pregsub_ex(apr_pool_t *p, char **result,
+//                                       const char *input, const char *source,
+//                                       apr_size_t nmatch,
+//                                       ap_regmatch_t pmatch[],
+//                                       apr_size_t maxlen);
+function ap_pregsub_ex(p: Papr_pool_t; result_: PPChar; const input, source: PChar;
+                                       nmatch: apr_size_t;
+                                       pmatch: array of ap_regmatch_t;
+                                       maxlen: apr_size_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_pregsub_ex' + LibSuff28;
+
+{*
+ * We want to downcase the type/subtype for comparison purposes
+ * but nothing else because ;parameter=foo values are case sensitive.
+ * @param s The content-type to convert to lowercase
+  }
+procedure ap_content_type_tolower(s: PChar);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_content_type_tolower' + LibSuff4;
+
+{*
+ * convert a string to all lowercase
+ * @param s The string to convert to lowercase
+  }
+procedure ap_str_tolower(s: PChar);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_str_tolower' + LibSuff4;
+
+{*
+ * convert a string to all uppercase
+ * @param s The string to convert to uppercase
+  }
+procedure ap_str_toupper(s: PChar);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_str_toupper' + LibSuff4;
+
+{*
+ * Search a string from left to right for the first occurrence of a
+ * specific character
+ * @param str The string to search
+ * @param c The character to search for
+ * @return The index of the first occurrence of c in str
+  }
+//AP_DECLARE(int) ap_ind(const char *str, char c);        /* Sigh... */
+function ap_ind(const str: PChar; c: Char): Integer;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_ind' + LibSuff8;
+
+{*
+ * Search a string from right to left for the first occurrence of a
+ * specific character
+ * @param str The string to search
+ * @param c The character to search for
+ * @return The index of the first occurrence of c in str
+  }
+function ap_rind(const str: PChar; c: Char): Integer;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_rind' + LibSuff8;
+
+{*
+ * Given a string, replace any bare &quot; with \\&quot; .
+ * @param p The pool to allocate memory from
+ * @param instring The string to search for &quot;
+ * @return A copy of the string with escaped quotes
+  }
+function ap_escape_quotes(p: Papr_pool_t; const instring: PChar): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_escape_quotes' + LibSuff8;
+
+{*
+ * Given a string, append the PID deliminated by delim.
+ * Usually used to create a pid-appended filepath name
+ * (eg: /a/b/foo -> /a/b/foo.6726). A function, and not
+ * a macro, to avoid unistd.h dependency
+ * @param p The pool to allocate memory from
+ * @param string The string to append the PID to
+ * @param delim The string to use to deliminate the string from the PID
+ * @return A copy of the string with the PID appended
+  }
+function ap_append_pid(p: Papr_pool_t; const string_, delim: PChar): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_append_pid' + LibSuff12;
+
+{*
+ * Parse a given timeout parameter string into an apr_interval_time_t value.
+ * The unit of the time interval is given as postfix string to the numeric
+ * string. Currently the following units are understood:
+ *
+ * ms    : milliseconds
+ * s     : seconds
+ * mi[n] : minutes
+ * h     : hours
+ *
+ * If no unit is contained in the given timeout parameter the default_time_unit
+ * will be used instead.
+ * @param timeout_parameter The string containing the timeout parameter.
+ * @param timeout The timeout value to be returned.
+ * @param default_time_unit The default time unit to use if none is specified
+ * in timeout_parameter.
+ * @return Status value indicating whether the parsing was successful or not.
+  }
+function ap_timeout_parameter_parse(const timeout_parameter: PChar;
+                                    timeout: Papr_interval_time_t;
+                                    const default_time_unit: PChar): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_timeout_parameter_parse' + LibSuff12;
+
+{*
+ * Determine if a request has a request body or not.
+ *
+ * @param r the request_rec of the request
+ * @return truth value
+  }
+function ap_request_has_body(r: Prequest_rec): Integer;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_request_has_body' + LibSuff4;
+
+{*
+ * Cleanup a string (mainly to be filesystem safe)
+ * We only allow '_' and alphanumeric chars. Non-printable
+ * map to 'x' and all others map to '_'
+ *
+ * @param  p pool to use to allocate dest
+ * @param  src string to clean up
+ * @param  dest cleaned up, allocated string
+ * @return Status value indicating whether the cleaning was successful or not.
+  }
+function ap_pstr2_alnum(p: Papr_pool_t; const src: PChar;
+                                        const dest: PPChar): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_pstr2_alnum' + LibSuff12;
+
+{*
+ * Cleanup a string (mainly to be filesystem safe)
+ * We only allow '_' and alphanumeric chars. Non-printable
+ * map to 'x' and all others map to '_'
+ *
+ * @param  src string to clean up
+ * @param  dest cleaned up, pre-allocated string
+ * @return Status value indicating whether the cleaning was successful or not.
+  }
+function ap_str2_alnum(const src: PChar; dest: PChar): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_str2_alnum' + LibSuff8;
+
+{*
+ * Structure to store the contents of an HTTP form of the type
+ * application/x-www-form-urlencoded.
+ *
+ * Currently it contains the name as a char* of maximum length
+ * HUGE_STRING_LEN, and a value in the form of a bucket brigade
+ * of arbitrary length.
+  }
+(* Const before type ignored *)
+
+type
+  ap_form_pair_t = record
+      name : PChar;
+      value : Papr_bucket_brigade;
+    end;
+{*
+ * Read the body and parse any form found, which must be of the
+ * type application/x-www-form-urlencoded.
+ * @param r request containing POSTed form data
+ * @param f filter
+ * @param ptr returned array of ap_form_pair_t
+ * @param num max num of params or -1 for unlimited
+ * @param size max size allowed for parsed data
+ * @return OK or HTTP error
+  }
+//AP_DECLARE(int) ap_parse_form_data(request_rec *r, struct ap_filter_t *f,
+//                                   apr_array_header_t **ptr,
+//                                   apr_size_t num, apr_size_t size);
+function ap_parse_form_data(r: Prequest_rec; f: Pap_filter_t;
+                            ptr: PPapr_array_header_t;
+                            num: apr_size_t; size: apr_size_t): Integer;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_parse_form_data' + LibSuff20;
+
+{ Misc system hackery  }
+{*
+ * Given the name of an object in the file system determine if it is a directory
+ * @param p The pool to allocate from
+ * @param name The name of the object to check
+ * @return 1 if it is a directory, 0 otherwise
+  }
+function ap_is_rdirectory(p: Papr_pool_t; const name: PChar): Integer;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_is_rdirectory' + LibSuff8;
+
+{*
+ * Given the name of an object in the file system determine if it is a directory - this version is symlink aware
+ * @param p The pool to allocate from
+ * @param name The name of the object to check
+ * @return 1 if it is a directory, 0 otherwise
+  }
+function ap_is_directory(p: Papr_pool_t; const name: PChar): Integer;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_is_directory' + LibSuff8;
+
+//#ifdef _OSD_POSIX
+//extern int os_init_job_environment(server_rec *s, const char *user_name, int one_process);
+//#endif /* _OSD_POSIX */
+//{$ifdef _OSD_POSIX}
+//function os_init_job_environment(s:Pserver_rec; const user_name:Pchar; one_process:integer):integer;cdecl;
+//{$endif} { _OSD_POSIX  }
+
+{*
+ * Determine the local host name for the current machine
+ * @param p The pool to allocate from
+ * @return A copy of the local host name
+  }
+//char *ap_get_local_host(apr_pool_t *p);
+
+{*
+ * Log an assertion to the error log
+ * @param szExp The assertion that failed
+ * @param szFile The file the assertion is in
+ * @param nLine The line the assertion is defined on
+  }
+procedure ap_log_assert(const szExp, szFile: PChar; nLine: Integer);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_log_assert' + LibSuff12;
+
+{*
+ * @internal Internal Assert function
+  }
+{#define ap_assert(exp) ((exp) ? (void)0 : ap_log_assert(#exp,__FILE__,__LINE__)) }
+{*
+ * Redefine assert() to something more useful for an Apache...
+ *
+ * Use ap_assert() if the condition should always be checked.
+ * Use AP_DEBUG_ASSERT() if the condition should only be checked when AP_DEBUG
+ * is defined.
+  }
+{#ifdef AP_DEBUG
+#define AP_DEBUG_ASSERT(exp) ap_assert(exp)
+#else
+#define AP_DEBUG_ASSERT(exp) ((void)0)
+#endif }
+{*
+ * @defgroup stopsignal Flags which indicate places where the server should stop for debugging.
+ * @
+ * A set of flags which indicate places where the server should raise(SIGSTOP).
+ * This is useful for debugging, because you can then attach to that process
+ * with gdb and continue.  This is important in cases where one_process
+ * debugging isn't possible.
+  }
+{* stop on a Detach  }
+{#define SIGSTOP_DETACH                  1 }
+{* stop making a child process  }
+{#define SIGSTOP_MAKE_CHILD              2 }
+{* stop spawning a child process  }
+{#define SIGSTOP_SPAWN_CHILD             4 }
+{* stop spawning a child process with a piped log  }
+{#define SIGSTOP_PIPED_LOG_SPAWN         8 }
+{* stop spawning a CGI child process  }
+{#define SIGSTOP_CGI_CHILD               16 }
+{* Macro to get GDB started  }
+{#ifdef DEBUG_SIGSTOP
+extern int raise_sigstop_flags;
+#define RAISE_SIGSTOP(x) do  if (raise_sigstop_flags & SIGSTOP_##x) raise(SIGSTOP);  while (0)
+#else
+#define RAISE_SIGSTOP(x)
+#endif }
+{* @  }
+
+{*
+ * Get HTML describing the address and (optionally) admin of the server.
+ * @param prefix Text which is prepended to the return value
+ * @param r The request_rec
+ * @return HTML describing the server, allocated in @a r's pool.
+  }
+function ap_psignature(const prefix: PChar; r: Prequest_rec): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_psignature' + LibSuff8;
+
+
+{* strtoul does not exist on sunos4.  }
+{$ifdef strtoul}
+{$undef strtoul}
+{$endif}
+
+///** strtoul does not exist on sunos4. */
+//#ifdef strtoul
+//#undef strtoul
+//#endif
+//#define strtoul strtoul_is_not_a_portable_function_use_strtol_instead
+
+{ The C library has functions that allow const to be silently dropped ...
+     these macros detect the drop in maintainer mode, but use the native
+     methods for normal builds
+
+     Note that on some platforms (e.g., AIX with gcc, Solaris with gcc), string.h needs
+     to be included before the macros are defined or compilation will fail.
+   }
+{#include <string.h>
+
+AP_DECLARE(char *) ap_strchr(char *s, int c);
+AP_DECLARE(const char *) ap_strchr_c(const char *s, int c);
+AP_DECLARE(char *) ap_strrchr(char *s, int c);
+AP_DECLARE(const char *) ap_strrchr_c(const char *s, int c);
+AP_DECLARE(char *) ap_strstr(char *s, const char *c);
+AP_DECLARE(const char *) ap_strstr_c(const char *s, const char *c);
+
+#ifdef AP_DEBUG
+
+#undef strchr
+# define strchr(s, c)  ap_strchr(s,c)
+#undef strrchr
+# define strrchr(s, c) ap_strrchr(s,c)
+#undef strstr
+# define strstr(s, c)  ap_strstr(s,c)
+
+#else
+ }
+{* use this instead of strchr  }
+{# define ap_strchr(s, c)     strchr(s, c) }
+{* use this instead of strchr  }
+{# define ap_strchr_c(s, c)   strchr(s, c) }
+{* use this instead of strrchr  }
+{# define ap_strrchr(s, c)    strrchr(s, c) }
+{* use this instead of strrchr  }
+{# define ap_strrchr_c(s, c)  strrchr(s, c) }
+{* use this instead of strrstr }
+{# define ap_strstr(s, c)     strstr(s, c) }
+{* use this instead of strrstr }
+{# define ap_strstr_c(s, c)   strstr(s, c) }
+{#endif }
+
+{*
+ * Generate pseudo random bytes.
+ * This is a convenience interface to apr_random. It is cheaper but less
+ * secure than apr_generate_random_bytes().
+ * @param buf where to store the bytes
+ * @param size number of bytes to generate
+ * @note ap_random_insecure_bytes() is thread-safe, it uses a mutex on
+ *       threaded MPMs.
+  }
+procedure ap_random_insecure_bytes(buf: Pointer; size: apr_size_t);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_random_insecure_bytes' + LibSuff8;
+
+{*
+ * Get a pseudo random number in a range.
+ * @param min low end of range
+ * @param max high end of range
+ * @return a number in the range
+  }
+function ap_random_pick(min, max: apr_uint32_t): apr_uint32_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_random_pick' + LibSuff8;
+
+{*
+ * Abort with a error message signifying out of memory
+  }
+//AP_DECLARE(void) ap_abort_on_oom(void) __attribute__((noreturn));
+procedure ap_abort_on_oom;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_abort_on_oom' + LibSuff0;
+
+{*
+ * Wrapper for malloc() that calls ap_abort_on_oom() if out of memory
+ * @param size size of the memory block
+ * @return pointer to the allocated memory
+ * @note ap_malloc may be implemented as a macro
+  }
+function ap_malloc(size: size_t): Pointer;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_malloc' + LibSuff4;
+
+{*
+ * Wrapper for calloc() that calls ap_abort_on_oom() if out of memory
+ * @param nelem number of elements to allocate memory for
+ * @param size size of a single element
+ * @return pointer to the allocated memory
+ * @note ap_calloc may be implemented as a macro
+  }
+//AP_DECLARE(void *) ap_calloc(size_t nelem, size_t size)
+//                   __attribute__((malloc))
+//                   AP_FN_ATTR_ALLOC_SIZE2(1,2);
+
+{*
+ * Wrapper for realloc() that calls ap_abort_on_oom() if out of memory
+ * @param ptr pointer to the old memory block (or NULL)
+ * @param size new size of the memory block
+ * @return pointer to the reallocated memory
+ * @note ap_realloc may be implemented as a macro
+  }
+//AP_DECLARE(void *) ap_realloc(void *ptr, size_t size)
+
+//#define AP_NORESTART APR_OS_START_USEERR + 1
+
+{ !APACHE_HTTPD_H  }
+{* @ //APACHE Daemon       }
+{* @ //APACHE Core         }
+{* @ //APACHE super group  }
+

+ 275 - 0
packages/httpd24/src/httpd24.pas

@@ -0,0 +1,275 @@
+{
+ httpd.pas
+
+ Copyright (C) 2006 Felipe Monteiro de Carvalho
+ (based on the Apache 2.0.58 headers)
+ Updated by Attila Borka in 2012 for the Apache 2.4.3 headers
+
+ This unit is a pascal binding for the Apache 2.4.3 headers.
+ The headers were released under the following copyright:
+}
+{ 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.
+  }
+
+{*
+ * @file httpd.h
+ * @brief HTTP Daemon routines
+ *
+ * @defgroup APACHE Apache HTTP Server
+ *
+ * Top level group of which all other groups are a member
+ * @
+ *
+ * @defgroup APACHE_MODS Loadable modules
+ *           Top level group for modules
+ * @defgroup APACHE_OS Operating System Specific
+ * @defgroup APACHE_INTERNAL Internal interfaces
+ * @defgroup APACHE_CORE Core routines
+ * @
+ * @defgroup APACHE_CORE_DAEMON HTTP Daemon Routine
+ * @
+  }
+unit httpd24;
+{$ifdef fpc}
+  {$mode delphi}{$H+}
+{$endif}
+{$ifdef Unix}
+  {$PACKRECORDS C}
+{$endif}
+
+{$IFDEF Apache1_3}
+  {$WARNING Apache1_3 is defined somewhere, but the HTTPD unit included is for Apache2_4}
+{$ENDIF}
+{$IFDEF Apache2_0}
+  {$WARNING Apache2_0 is defined somewhere, but the HTTPD unit included is for Apache2_4}
+{$ENDIF}
+{$IFDEF Apache2_2}
+  {$WARNING Apache2_2 is defined somewhere, but the HTTPD unit included is for Apache2_4}
+{$ENDIF}
+
+{$IFDEF FPCAPACHE_1_3}
+  {$WARNING FPCAPACHE_1_3 is defined somewhere, but the HTTPD unit included is for FPCAPACHE_2_4}
+{$ENDIF}
+{$IFDEF FPCAPACHE_2_0}
+  {$WARNING FPCAPACHE_2_0 is defined somewhere, but the HTTPD unit included is for FPCAPACHE_2_4}
+{$ENDIF}
+{$IFDEF FPCAPACHE_2_2}
+  {$WARNING FPCAPACHE_2_2 is defined somewhere, but the HTTPD unit included is for FPCAPACHE_2_4}
+{$ENDIF}
+
+{$DEFINE Apache2_4}
+{$DEFINE FPCAPACHE_2_4}
+
+interface
+
+uses
+{$ifdef WINDOWS}
+  Windows,
+{$ELSE}
+  UnixType,
+{$ENDIF}
+  ctypes, apr24;
+
+const
+{$ifndef fpc}
+  LineEnding = #13#10;
+{$endif}
+
+{$IFDEF WINDOWS}
+  LibHTTPD = 'libhttpd.dll';
+{$ELSE}
+  LibHTTPD = '';
+{$ENDIF}
+
+{$IFDEF WINDOWS}
+  LibAPRUtil = 'libaprutil-1.dll';
+{$ELSE}
+  LibAPRUtil = '';
+{$ENDIF}
+
+type
+  { configuration vector structure , moved from http_config.inc (http_config.h)}
+  ap_conf_vector_t = record end;
+  Pap_conf_vector_t = ^ap_conf_vector_t;
+  PPap_conf_vector_t = ^Pap_conf_vector_t;
+
+  {*
+   Shortcuts for FPC, so no extra includes are needed.
+   It would require more of the header files from the Apache httpd, apr and apr-util
+   source code packages.
+   *}
+  {apr_thread_mutex_t is OS dependent, found in apr-X.X.X/include/arch/.../apr_arch_thread_mutex.h}
+  Papr_thread_mutex_t = Pointer;//^apr_thread_mutex_t;   used in http.inc -> request_rec record
+
+  {from apr-X.X.X/include/apr_network_io.h  used in server_addr_rec record in httpd.inc}
+  Papr_sockaddr_t = Pointer;//^apr_sockaddr_t
+  apr_port_t = word;//apr_uint16_t
+  {end apr_network_io.h}
+
+  { A structure to represent sockets }
+  apr_socket_t = record end;
+  Papr_socket_t = ^apr_socket_t;
+  PPapr_socket_t = ^Papr_socket_t;
+  {end apr_network_io.h}
+
+  {from apr-X.X.X/include/apr_thread_proc.h , used in http_log.h (http_log.inc)}
+  apr_cmdtype_e = (
+      APR_SHELLCMD,           //**< use the shell to invoke the program */
+      APR_PROGRAM,            //**< invoke the program directly, no copied env */
+      APR_PROGRAM_ENV,        //**< invoke the program, replicating our environment */
+      APR_PROGRAM_PATH,       //**< find program on PATH, use our environment */
+      APR_SHELLCMD_ENV        {/**< use the shell to invoke the program,
+                               *   replicating our environment
+                               *}
+  );
+  {*
+   end Shortcuts for FPC
+   *}
+{
+  Main httpd header files
+
+  Note: There are more include files other then these, because some include files
+        include more files.
+}
+
+//{$include ap_provider.inc}
+{$include util_cfgtree.inc}
+
+{$include httpd.inc}
+{$include http_config.inc}
+{$include http_core.inc}
+{$include http_log.inc}
+//{$include http_main.inc}
+{$include http_protocol.inc}
+//{$include http_request.inc}
+//{$include http_connection.inc}
+//{$include http_vhost.inc}
+
+//{$include util_script.inc}
+//{$include util_time.inc}
+//{$include util_md5.inc}
+//{$include ap_mpm.inc}
+
+implementation
+  { Internal representation for a HTTP protocol number, e.g., HTTP/1.1 }
+  function HTTP_VERSION(major, minor: Integer): Integer;
+  begin
+    HTTP_VERSION := (1000 * major + minor);
+  end;
+
+  { Major part of HTTP protocol }
+  function HTTP_VERSION_MAJOR(number: Integer): Integer;
+  begin
+    HTTP_VERSION_MAJOR := number div 1000;
+  end;
+
+  { Minor part of HTTP protocol }
+  function HTTP_VERSION_MINOR(number: Integer): Integer;
+  begin
+    HTTP_VERSION_MINOR := number mod 1000;
+  end;
+
+  function ap_is_HTTP_INFO(x : Integer): Boolean;  
+  begin
+    ap_is_HTTP_INFO := ((x>=100) and (x<200));
+  end;
+
+  function ap_is_HTTP_SUCCESS(x : Integer) : Boolean;
+  begin
+    ap_is_HTTP_SUCCESS := ((x>=200) and (x<300));
+  end;
+
+  function ap_is_HTTP_REDIRECT(x : Integer) : Boolean;
+  begin
+    ap_is_HTTP_REDIRECT := ((x>=300) and (x<400));
+  end;
+
+  function ap_is_HTTP_ERROR(x : Integer) : Boolean;
+  begin
+    ap_is_HTTP_ERROR := ((x>=400) and (x<600));
+  end;
+
+  function ap_is_HTTP_CLIENT_ERROR(x : Integer) : Boolean;
+  begin
+    ap_is_HTTP_CLIENT_ERROR := ((x>=400) and (x<500));
+  end;
+
+  function ap_is_HTTP_SERVER_ERROR(x : Integer) : Boolean;
+  begin
+    ap_is_HTTP_SERVER_ERROR := ((x>=500) and (x<600));
+  end;
+
+  function ap_is_HTTP_VALID_RESPONSE(x : Integer) : Boolean;
+  begin
+    ap_is_HTTP_VALID_RESPONSE := ((x>=100) and (x<600));
+  end;
+
+  function ap_status_drops_connection(x : Integer): Boolean;
+  begin
+    case x of
+      HTTP_BAD_REQUEST,
+      HTTP_REQUEST_TIME_OUT,
+      HTTP_LENGTH_REQUIRED,
+      HTTP_REQUEST_ENTITY_TOO_LARGE,
+      HTTP_REQUEST_URI_TOO_LARGE,
+      HTTP_INTERNAL_SERVER_ERROR,
+      HTTP_SERVICE_UNAVAILABLE,
+      HTTP_NOT_IMPLEMENTED:
+        Result := true;
+      else
+        Result := false;
+    end;
+  end;
+
+  function ap_escape_uri(ppool: Papr_pool_t; const path: PChar) : PChar;  
+  begin
+    ap_escape_uri:=ap_os_escape_path(ppool,path,1);
+  end;
+
+  function ap_escape_html(p: Papr_pool_t; const s: PChar) : PChar;
+  begin
+    ap_escape_html:=ap_escape_html2(p,s,0);
+  end;
+
+//********************************************************************
+  { from http_config.inc }
+
+  { Use this in all standard modules }
+  procedure STANDARD20_MODULE_STUFF(var mod_: module);
+  begin
+    mod_.version := MODULE_MAGIC_NUMBER_MAJOR;
+    mod_.minor_version := MODULE_MAGIC_NUMBER_MINOR;
+    mod_.module_index := -1;
+  //  mod_.name: PChar;
+    mod_.dynamic_load_handle := nil;
+    mod_.next := nil;
+    mod_.magic := MODULE_MAGIC_COOKIE;
+    mod_.rewrite_args := nil;
+  end;
+
+  { Use this only in MPMs }
+  procedure MPM20_MODULE_STUFF(var mod_: module);
+  begin
+    mod_.version := MODULE_MAGIC_NUMBER_MAJOR;
+    mod_.minor_version := MODULE_MAGIC_NUMBER_MINOR;
+    mod_.module_index := -1;
+  //  mod_.name: PChar;
+    mod_.dynamic_load_handle := nil;
+    mod_.next := nil;
+    mod_.magic := MODULE_MAGIC_COOKIE;
+  end;
+
+end.

+ 94 - 0
packages/httpd24/src/util_cfgtree.inc

@@ -0,0 +1,94 @@
+{* 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.
+ *}
+
+(**
+ * @file  util_cfgtree.h
+ * @brief Config Tree Package
+ *
+ * @defgroup APACHE_CORE_CONFIG_TREE Config Tree Package
+ * @ingroup  APACHE_CORE_CONFIG
+ * @{
+ *)
+
+{$ifndef AP_CONFTREE_H}
+  {$define AP_CONFTREE_H}
+
+//#include "ap_config.h"
+
+
+type
+  Pap_directive_t = ^ap_directive_t;
+  PPap_directive_t = ^Pap_directive_t;
+
+{**
+ * @brief Structure used to build the config tree.
+ *
+ * The config tree only stores
+ * the directives that will be active in the running server.  Directives
+ * that contain other directions, such as &lt;Directory ...&gt; cause a sub-level
+ * to be created, where the included directives are stored.  The closing
+ * directive (&lt;/Directory&gt;) is not stored in the tree.
+ *}
+ap_directive_t = record
+    {** The current directive *}
+    directive: PChar;
+    {** The arguments for the current directive, stored as a space
+     *  separated list *}
+    args: PChar;
+    {** The next directive node in the tree *}
+    next: Pap_directive_t;
+    {** The first child node of this directive *}
+    first_child: Pap_directive_t;
+    {** The parent node of this directive *}
+    parent: Pap_directive_t;
+
+    {** directive's module can store add'l data here *}
+    data: Pointer;
+
+    {* ### these may go away in the future, but are needed for now *}
+    {** The name of the file this directive was found in *}
+    filename: PChar;
+    {** The line number the directive was on *}
+    line_num: Integer;
+
+    {** A short-cut towards the last directive node in the tree.
+     *  The value may not always be up-to-date but it always points to
+     *  somewhere in the tree, nearer to the tail.
+     *  This value is only set in the first node
+     *}
+    last: Pap_directive_t;
+end;
+
+{**
+ * The root of the configuration tree
+ *}
+//AP_DECLARE_DATA extern ap_directive_t *ap_conftree;
+
+{**
+ * Add a node to the configuration tree.
+ * @param parent The current parent node.  If the added node is a first_child,
+                 then this is changed to the current node
+ * @param current The current node
+ * @param toadd The node to add to the tree
+ * @param child Is the node to add a child node
+ * @return the added node
+ *}
+//ap_directive_t *ap_add_node(ap_directive_t **parent, ap_directive_t *current,
+//                            ap_directive_t *toadd, int child);
+
+
+{$endif}
+(** @} *)

+ 687 - 0
packages/httpd24/src/util_filter.inc

@@ -0,0 +1,687 @@
+{* 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.
+ *}
+
+{*
+ * @file util_filter.h
+ * @brief Apache filter library
+  }
+(*
+#ifndef AP_FILTER_H
+#define AP_FILTER_H
+
+#include "apr.h"
+#include "apr_buckets.h"
+
+#include "httpd.h"
+
+#if APR_HAVE_STDARG_H
+#include <stdarg.h>
+#endif
+*)
+
+{*
+ * @brief input filtering modes
+  }
+type
+  Pap_input_mode_t = ^ap_input_mode_t;
+  ap_input_mode_t = (
+  {* The filter should return at most readbytes data.  }
+      AP_MODE_READBYTES,
+
+  {* The filter should return at most one line of CRLF data.
+   *  (If a potential line is too long or no CRLF is found, the
+   *   filter may return partial data).}
+      AP_MODE_GETLINE,
+
+  {* The filter should implicitly eat any CRLF pairs that it sees.  }
+      AP_MODE_EATCRLF,
+
+  {* The filter read should be treated as speculative and any returned
+   *  data should be stored for later retrieval in another mode.  }
+      AP_MODE_SPECULATIVE,
+
+  {* The filter read should be exhaustive and read until it can not
+   *  read any more.
+   *  Use this mode with extreme caution.}
+      AP_MODE_EXHAUSTIVE,
+
+  {* The filter should initialize the connection if needed,
+   *  NNTP or FTP over SSL for example.}
+      AP_MODE_INIT
+  );
+
+{*
+ * @defgroup APACHE_CORE_FILTER Filter Chain
+ * @ingroup  APACHE_CORE
+ *
+ * Filters operate using a "chaining" mechanism. The filters are chained
+ * together into a sequence. When output is generated, it is passed through
+ * each of the filters on this chain, until it reaches the end (or "bottom")
+ * and is placed onto the network.
+ *
+ * The top of the chain, the code generating the output, is typically called
+ * a "content generator." The content generator's output is fed into the
+ * filter chain using the standard Apache output mechanisms: ap_rputs(),
+ * ap_rprintf(), ap_rwrite(), etc.
+ *
+ * Each filter is defined by a callback. This callback takes the output from
+ * the previous filter (or the content generator if there is no previous
+ * filter), operates on it, and passes the result to the next filter in the
+ * chain. This pass-off is performed using the ap_fc_* functions, such as
+ * ap_fc_puts(), ap_fc_printf(), ap_fc_write(), etc.
+ *
+ * When content generation is complete, the system will pass an "end of
+ * stream" marker into the filter chain. The filters will use this to flush
+ * out any internal state and to detect incomplete syntax (for example, an
+ * unterminated SSI directive).
+ *
+ * @
+  }
+
+{ forward declare the filter type  }
+//typedef struct ap_filter_t ap_filter_t;
+type
+  Pap_filter_t = ^ap_filter_t;
+
+{*
+ * @name Filter callbacks
+ *
+ * This function type is used for filter callbacks. It will be passed a
+ * pointer to "this" filter, and a "bucket brigade" containing the content
+ * to be filtered.
+ *
+ * In filter->ctx, the callback will find its context. This context is
+ * provided here, so that a filter may be installed multiple times, each
+ * receiving its own per-install context pointer.
+ *
+ * Callbacks are associated with a filter definition, which is specified
+ * by name. See ap_register_input_filter() and ap_register_output_filter()
+ * for setting the association between a name for a filter and its
+ * associated callback (and other information).
+ *
+ * If the initialization function argument passed to the registration
+ * functions is non-NULL, it will be called iff the filter is in the input
+ * or output filter chains and before any data is generated to allow the
+ * filter to prepare for processing.
+ *
+ * The bucket brigade always belongs to the caller, but the filter
+ * is free to use the buckets within it as it sees fit. Normally,
+ * the brigade will be returned empty. Buckets *may not* be retained
+ * between successive calls to the filter unless they have been
+ * "set aside" with a call apr_bucket_setaside. Typically this will
+ * be done with ap_save_brigade(). Buckets removed from the brigade
+ * become the responsibility of the filter, which must arrange for
+ * them to be deleted, either by doing so directly or by inserting
+ * them in a brigade which will subsequently be destroyed.
+ *
+ * For the input and output filters, the return value of a filter should be
+ * an APR status value.  For the init function, the return value should
+ * be an HTTP error code or OK if it was successful.
+ *
+ * @ingroup filter
+ * @
+  }
+  ap_out_filter_func = function (f: Pap_filter_t;
+                                 b: Papr_bucket_brigade):apr_status_t;
+
+  ap_in_filter_func = function (f: Pap_filter_t; 
+                                b: Papr_bucket_brigade;
+                                mode: ap_input_mode_t;
+                                block: apr_read_type_e;
+                                readbytes: apr_off_t): apr_status_t;
+
+  ap_init_filter_func = function (f: Pap_filter_t): Longint;
+
+  Pap_filter_func = ^ap_filter_func;
+  ap_filter_func = record
+      case longint of
+        0 : ( out_func : ap_out_filter_func );
+        1 : ( in_func : ap_in_filter_func );
+      end;
+  {* @  }
+
+{*
+ * Filters have different types/classifications. These are used to group
+ * and sort the filters to properly sequence their operation.
+ *
+ * The types have a particular sort order, which allows us to insert them
+ * into the filter chain in a determistic order. Within a particular grouping,
+ * the ordering is equivalent to the order of calls to ap_add_*_filter().
+  }
+  Pap_filter_type = ^ap_filter_type;
+  ap_filter_type = (
+    {** These filters are used to alter the content that is passed through
+     *  them. Examples are SSI or PHP.  }
+    AP_FTYPE_RESOURCE = 10,
+
+    {** These filters are used to alter the content as a whole, but after all
+     *  AP_FTYPE_RESOURCE filters are executed.  These filters should not
+     *  change the content-type.  An example is deflate.   }
+    AP_FTYPE_CONTENT_SET = 20,
+
+    {** These filters are used to handle the protocol between server and
+     *  client.  Examples are HTTP and POP.  }
+    AP_FTYPE_PROTOCOL = 30,
+
+    {** These filters implement transport encodings (e.g., chunking).  }
+    AP_FTYPE_TRANSCODE = 40,
+
+    {** These filters will alter the content, but in ways that are
+     *  more strongly associated with the connection.  Examples are
+     *  splitting an HTTP connection into multiple requests and
+     *  buffering HTTP responses across multiple requests.
+     *
+     *  It is important to note that these types of filters are not
+     *  allowed in a sub-request. A sub-request's output can certainly
+     *  be filtered by ::AP_FTYPE_RESOURCE filters, but all of the "final
+     *  processing" is determined by the main request.  }
+    AP_FTYPE_CONNECTION = 50,
+
+    {** These filters don't alter the content.  They are responsible for
+     *  sending/receiving data to/from the client.  }
+    AP_FTYPE_NETWORK = 60
+  );
+
+{*
+ * This is the request-time context structure for an installed filter (in
+ * the output filter chain). It provides the callback to use for filtering,
+ * the request this filter is associated with (which is important when
+ * an output chain also includes sub-request filters), the context for this
+ * installed filter, and the filter ordering/chaining fields.
+ *
+ * Filter callbacks are free to use ->ctx as they please, to store context
+ * during the filter process. Generally, this is superior over associating
+ * the state directly with the request. A callback should not change any of
+ * the other fields.
+  }
+
+//  typedef struct ap_filter_rec_t ap_filter_rec_t;
+//  typedef struct ap_filter_provider_t ap_filter_provider_t;
+  Pap_filter_rec_t = ^ap_filter_rec_t;
+
+  Pap_filter_provider_t = ^ap_filter_provider_t;
+  ap_filter_provider_t = record end;
+{*
+ * @brief This structure is used for recording information about the
+ * registered filters. It associates a name with the filter's callback
+ * and filter type.
+ *
+ * At the moment, these are simply linked in a chain, so a ->next pointer
+ * is available.
+ *
+ * It is used for any filter that can be inserted in the filter chain.
+ * This may be either a httpd-2.0 filter or a mod_filter harness.
+ * In the latter case it contains dispatch, provider and protocol information.
+ * In the former case, the new fields (from dispatch) are ignored.
+  }
+  ap_filter_rec_t = record
+  {* The registered name for this filter  }
+        name : Pchar;
+
+  {* The function to call when this filter is invoked.  }
+        filter_func : ap_filter_func;
+
+  {* The function to call directly before the handlers are invoked
+   * for a request.  The init function is called once directly
+   * before running the handlers for a request or subrequest.  The
+   * init function is never called for a connection filter (with
+   * ftype >= AP_FTYPE_CONNECTION).  Any use of this function for
+   * filters for protocols other than HTTP is specified by the
+   * module supported that protocol.
+   }
+        filter_init_func : ap_init_filter_func;
+
+  {* The next filter_rec in the list  }
+        next : Pap_filter_rec_t;
+
+  {* Providers for this filter  }
+        providers : Pap_filter_provider_t;
+
+  {* The type of filter, either AP_FTYPE_CONTENT or AP_FTYPE_CONNECTION.
+   * An AP_FTYPE_CONTENT filter modifies the data based on information
+   * found in the content.  An AP_FTYPE_CONNECTION filter modifies the
+   * data based on the type of connection.}
+        ftype : ap_filter_type;
+
+  {* Trace level for this filter  }
+        debug : longint;
+
+  {* Protocol flags for this filter  }
+        proto_flags : dword;
+      end;
+
+  {*
+   * @brief The representation of a filter chain.
+   *
+   * Each request has a list
+   * of these structures which are called in turn to filter the data.  Sub
+   * requests get an exact copy of the main requests filter chain.
+    }
+    ap_filter_t = record
+  {* The internal representation of this filter.  This includes
+   *  the filter's name, type, and the actual function pointer.}
+        frec : Pap_filter_rec_t;
+
+  {* A place to store any data associated with the current filter  }
+        ctx : pointer;
+
+  {* The next filter in the chain  }
+        next : Pap_filter_t;
+
+  {* The request_rec associated with the current filter.  If a sub-request
+   *  adds filters, then the sub-request is the request associated with the
+   *  filter.}
+        r : Prequest_rec;
+
+  {* The conn_rec associated with the current filter.  This is analogous
+   *  to the request_rec, except that it is used for connection filters.}
+        c : Pconn_rec;
+      end;
+
+{*
+ * Get the current bucket brigade from the next filter on the filter
+ * stack.  The filter returns an apr_status_t value.  If the bottom-most
+ * filter doesn't read from the network, then ::AP_NOBODY_READ is returned.
+ * The bucket brigade will be empty when there is nothing left to get.
+ * @param filter The next filter in the chain
+ * @param bucket The current bucket brigade.  The original brigade passed
+ *               to ap_get_brigade() must be empty.
+ * @param mode   The way in which the data should be read
+ * @param block  How the operations should be performed
+ *               ::APR_BLOCK_READ, ::APR_NONBLOCK_READ
+ * @param readbytes How many bytes to read from the next filter.
+  }
+function ap_get_brigade(filter: Pap_filter_t;
+                        bucket: Papr_bucket_brigade;
+                        mode: ap_input_mode_t;
+                        block: apr_read_type_e;
+                        readbytes: apr_off_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_get_brigade' + LibSuff24;
+
+{*
+ * Pass the current bucket brigade down to the next filter on the filter
+ * stack.  The filter returns an apr_status_t value.  If the bottom-most
+ * filter doesn't write to the network, then ::AP_NOBODY_WROTE is returned.
+ * @param filter The next filter in the chain
+ * @param bucket The current bucket brigade
+ *
+ * @remark Ownership of the brigade is retained by the caller. On return,
+ *         the contents of the brigade are UNDEFINED, and the caller must
+ *         either call apr_brigade_cleanup or apr_brigade_destroy on
+ *         the brigade.
+  }
+function ap_pass_brigade(filter: Pap_filter_t;
+                         bucket: Papr_bucket_brigade): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_pass_brigade' + LibSuff8;
+
+{*
+ * Pass the current bucket brigade down to the next filter on the filter
+ * stack checking for filter errors.  The filter returns an apr_status_t value.
+ * Returns ::OK if the brigade is successfully passed
+ *         ::AP_FILTER_ERROR on a filter error
+ *         ::HTTP_INTERNAL_SERVER_ERROR on all other errors
+ * @param r      The request rec
+ * @param bucket The current bucket brigade
+ * @param fmt The format string. If NULL defaults to "ap_pass_brigade returned"
+ * @param ... The arguments to use to fill out the format string
+ * @remark Ownership of the brigade is retained by the caller. On return,
+ *         the contents of the brigade are UNDEFINED, and the caller must
+ *         either call apr_brigade_cleanup or apr_brigade_destroy on
+ *         the brigade.
+  }
+//AP_DECLARE(apr_status_t) ap_pass_brigade_fchk(request_rec *r,
+//                                              apr_bucket_brigade *bucket,
+//                                              const char *fmt,
+//                                              ...);
+function ap_pass_brigade_fchk(r: Prequest_rec;
+                              bucket: Papr_bucket_brigade;
+                              const fmt: PChar;
+                              fmt_args: array of const): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_pass_brigade_fchk';
+
+{*
+ * This function is used to register an input filter with the system.
+ * After this registration is performed, then a filter may be added
+ * into the filter chain by using ap_add_input_filter() and simply
+ * specifying the name.
+ *
+ * @param name The name to attach to the filter function
+ * @param filter_func The filter function to name
+ * @param filter_init The function to call before the filter handlers
+                      are invoked
+ * @param ftype The type of filter function, either ::AP_FTYPE_CONTENT_SET or
+ *              ::AP_FTYPE_CONNECTION
+ * @see add_input_filter()
+  }
+function ap_register_input_filter(const name: PChar;
+                                  filter_func: ap_in_filter_func;
+                                  filter_init: ap_init_filter_func;
+                                  ftype: ap_filter_type): Pap_filter_rec_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_register_input_filter' + LibSuff16;
+
+{* @deprecated @see ap_register_output_filter_protocol  }
+function ap_register_output_filter(const name: PChar;
+                                   filter_func: ap_out_filter_func;
+                                   filter_init: ap_init_filter_func;
+                                   ftype: ap_filter_type): Pap_filter_rec_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_register_output_filter' + LibSuff16;
+
+{ For httpd-?.? I suggest replacing the above with
+#define ap_register_output_filter(name,ffunc,init,ftype) \
+             ap_register_output_filter_protocol(name,ffunc,init,ftype,0)
+ }
+
+{*
+ * This function is used to register an output filter with the system.
+ * After this registration is performed, then a filter may be added
+ * directly to the filter chain by using ap_add_output_filter() and
+ * simply specifying the name, or as a provider under mod_filter.
+ *
+ * @param name The name to attach to the filter function
+ * @param filter_func The filter function to name
+ * @param filter_init The function to call before the filter handlers
+ *                    are invoked
+ * @param ftype The type of filter function, either ::AP_FTYPE_CONTENT_SET or
+ *              ::AP_FTYPE_CONNECTION
+ * @param proto_flags Protocol flags: logical OR of AP_FILTER_PROTO_* bits
+ * @return the filter rec
+ * @see ap_add_output_filter()
+  }
+function ap_register_output_filter_protocol(const name: PChar;
+                                            filter_func: ap_out_filter_func;
+                                            filter_init: ap_init_filter_func;
+                                            ftype: ap_filter_type;
+                                            proto_flags: dword): Pap_filter_rec_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_register_output_filter_protocol' + LibSuff20;
+
+{*
+ * Adds a named filter into the filter chain on the specified request record.
+ * The filter will be installed with the specified context pointer.
+ *
+ * Filters added in this way will always be placed at the end of the filters
+ * that have the same type (thus, the filters have the same order as the
+ * calls to ap_add_filter). If the current filter chain contains filters
+ * from another request, then this filter will be added before those other
+ * filters.
+ *
+ * To re-iterate that last comment.  This function is building a FIFO
+ * list of filters.  Take note of that when adding your filter to the chain.
+ *
+ * @param name The name of the filter to add
+ * @param ctx Context data to provide to the filter
+ * @param r The request to add this filter for (or NULL if it isn't associated with a request)
+ * @param c The connection to add the fillter for
+  }
+function ap_add_input_filter(const name: PChar;
+                             ctx: Pointer;
+                             r: Prequest_rec;
+                             c: Pconn_rec): Pap_filter_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_add_input_filter' + LibSuff16;
+
+{*
+ * Variant of ap_add_input_filter() that accepts a registered filter handle
+ * (as returned by ap_register_input_filter()) rather than a filter name
+ *
+ * @param f The filter handle to add
+ * @param ctx Context data to provide to the filter
+ * @param r The request to add this filter for (or NULL if it isn't associated with a request)
+ * @param c The connection to add the fillter for
+  }
+function ap_add_input_filter_handle(f: Pap_filter_t;
+                                    ctx: Pointer;
+                                    r: Prequest_rec;
+                                    c: Pconn_rec): Pap_filter_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_add_input_filter_handle' + LibSuff16;
+
+{*
+ * Returns the filter handle for use with ap_add_input_filter_handle.
+ *
+ * @param name The filter name to look up
+  }
+function ap_get_input_filter_handle(const name: PChar): Pap_filter_rec_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_get_input_filter_handle' + LibSuff4;
+
+{*
+ * Add a filter to the current request.  Filters are added in a FIFO manner.
+ * The first filter added will be the first filter called.
+ * @param name The name of the filter to add
+ * @param ctx Context data to set in the filter
+ * @param r The request to add this filter for (or NULL if it isn't associated with a request)
+ * @param c The connection to add this filter for
+ * @note If adding a connection-level output filter (i.e. where the type
+ * is >= AP_FTYPE_CONNECTION) during processing of a request, the request
+ * object r must be passed in to ensure the filter chains are modified
+ * correctly.  f->r will still be initialized as NULL in the new filter.
+  }
+function ap_add_output_filter(const name: PChar;
+                              ctx: Pointer;
+                              r: Prequest_rec;
+                              c: Pconn_rec): Pap_filter_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_add_output_filter' + LibSuff16;
+
+{*
+ * Variant of ap_add_output_filter() that accepts a registered filter handle
+ * (as returned by ap_register_output_filter()) rather than a filter name
+ *
+ * @param f The filter handle to add
+ * @param ctx Context data to set in the filter
+ * @param r The request to add this filter for (or NULL if it isn't associated with a request)
+ * @param c The connection to add the filter for
+ * @note If adding a connection-level output filter (i.e. where the type
+ * is >= AP_FTYPE_CONNECTION) during processing of a request, the request
+ * object r must be passed in to ensure the filter chains are modified
+ * correctly.  f->r will still be initialized as NULL in the new filter.
+  }
+function ap_add_output_filter_handle(f: Pap_filter_rec_t;
+                                     ctx: Pointer;
+                                     r: Prequest_rec;
+                                     c: Pconn_rec): Pap_filter_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_add_output_filter_handle' + LibSuff16;
+
+{*
+ * Returns the filter handle for use with ap_add_output_filter_handle.
+ *
+ * @param name The filter name to look up
+  }
+function ap_get_output_filter_handle(const name: PChar): Pap_filter_rec_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_get_output_filter_handle' + LibSuff4;
+
+
+{*
+ * Remove an input filter from either the request or connection stack
+ * it is associated with.
+ * @param f The filter to remove
+  }
+procedure ap_remove_input_filter(f: Pap_filter_t);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_remove_input_filter' + LibSuff4;
+
+{*
+ * Remove an output filter from either the request or connection stack
+ * it is associated with.
+ * @param f The filter to remove
+  }
+procedure ap_remove_output_filter(f: Pap_filter_t);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_remove_output_filter' + LibSuff4;
+
+{ The next two filters are for abstraction purposes only.  They could be
+ * done away with, but that would require that we break modules if we ever
+ * want to change our filter registration method.  The basic idea, is that
+ * all filters have a place to store data, the ctx pointer.  These functions
+ * fill out that pointer with a bucket brigade, and retrieve that data on
+ * the next call.  The nice thing about these functions, is that they
+ * automatically concatenate the bucket brigades together for you.  This means
+ * that if you have already stored a brigade in the filters ctx pointer, then
+ * when you add more it will be tacked onto the end of that brigade.  When
+ * you retrieve data, if you pass in a bucket brigade to the get function,
+ * it will append the current brigade onto the one that you are retrieving.
+  }
+
+{*
+ * prepare a bucket brigade to be setaside.  If a different brigade was
+ * set-aside earlier, then the two brigades are concatenated together.
+ * @param f The current filter
+ * @param save_to The brigade that was previously set-aside.  Regardless, the
+ *             new bucket brigade is returned in this location.
+ * @param b The bucket brigade to save aside.  This brigade is always empty
+ *          on return
+ * @param p Ensure that all data in the brigade lives as long as this pool
+  }
+function ap_save_brigade(f: Pap_filter_t;
+                         save_to, b: PPapr_bucket_brigade;
+                         p: Papr_pool_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_save_brigade' + LibSuff16;
+
+{*
+ * Flush function for apr_brigade_* calls.  This calls ap_pass_brigade
+ * to flush the brigade if the brigade buffer overflows.
+ * @param bb The brigade to flush
+ * @param ctx The filter to pass the brigade to
+ * @note this function has nothing to do with FLUSH buckets. It is simply
+ * a way to flush content out of a brigade and down a filter stack.
+  }
+//AP_DECLARE_NONSTD(apr_status_t) ap_filter_flush(apr_bucket_brigade *bb,
+//                                                void *ctx);
+function ap_filter_flush(bb: Papr_bucket_brigade; ctx: Pointer): apr_status_t;
+ cdecl; external LibHTTPD name LibNamePrefix + 'ap_filter_flush';
+
+{*
+ * Flush the current brigade down the filter stack.
+ * @param f The filter we are passing to
+ * @param bb The brigade to flush
+  }
+function ap_fflush(f: Pap_filter_t; bb: Papr_bucket_brigade): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_fflush' + LibSuff8;
+
+{*
+ * Write a buffer for the current filter, buffering if possible.
+ * @param f the filter we are writing to
+ * @param bb The brigade to buffer into
+ * @param data The data to write
+ * @param nbyte The number of bytes in the data
+  }
+//#define ap_fwrite(f, bb, data, nbyte) \
+//        apr_brigade_write(bb, ap_filter_flush, f, data, nbyte)
+
+{*
+ * Write a buffer for the current filter, buffering if possible.
+ * @param f the filter we are writing to
+ * @param bb The brigade to buffer into
+ * @param str The string to write
+  }
+//#define ap_fputs(f, bb, str) \
+//        apr_brigade_puts(bb, ap_filter_flush, f, str)
+
+{*
+ * Write a character for the current filter, buffering if possible.
+ * @param f the filter we are writing to
+ * @param bb The brigade to buffer into
+ * @param c The character to write
+  }
+//#define ap_fputc(f, bb, c) \
+//        apr_brigade_putc(bb, ap_filter_flush, f, c)
+
+{*
+ * Write an unspecified number of strings to the current filter
+ * @param f the filter we are writing to
+ * @param bb The brigade to buffer into
+ * @param ... The strings to write
+  }
+//AP_DECLARE_NONSTD(apr_status_t) ap_fputstrs(ap_filter_t *f,
+//                                            apr_bucket_brigade *bb,
+//                                            ...)
+//                                AP_FN_ATTR_SENTINEL;
+function ap_fputstrs(f: Pap_filter_t;
+                     bb: Papr_bucket_brigade;
+                     strs_to_write: array of const): apr_status_t;
+ cdecl; external LibHTTPD name 'ap_fputstrs';
+
+{*
+ * Output data to the filter in printf format
+ * @param f the filter we are writing to
+ * @param bb The brigade to buffer into
+ * @param fmt The format string
+ * @param ... The arguments to use to fill out the format string
+  }
+//AP_DECLARE_NONSTD(apr_status_t) ap_fprintf(ap_filter_t *f,
+//                                           apr_bucket_brigade *bb,
+//                                           const char *fmt,
+//                                           ...)
+//        __attribute__((format(printf,3,4)));
+function ap_fprintf(f: Pap_filter_t;
+                    bb: Papr_bucket_brigade;
+                    const fmt: PChar;
+                    fmt_args: array of const): apr_status_t;
+ cdecl; external LibHTTPD name 'ap_fprintf';
+
+{*
+ * set protocol requirements for an output content filter
+ * (only works with AP_FTYPE_RESOURCE and AP_FTYPE_CONTENT_SET)
+ * @param f the filter in question
+ * @param proto_flags Logical OR of AP_FILTER_PROTO_* bits
+  }
+procedure ap_filter_protocol(f: Pap_filter_t; proto_flags: dword);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_filter_protocol' + LibSuff8;
+
+const
+{* Filter changes contents (so invalidating checksums/etc)  }
+  AP_FILTER_PROTO_CHANGE = $1;    
+{* Filter changes length of contents (so invalidating content-length/etc)  }
+  AP_FILTER_PROTO_CHANGE_LENGTH = $2;    
+{* Filter requires complete input and can't work on byteranges  }
+  AP_FILTER_PROTO_NO_BYTERANGE = $4;    
+{* Filter should not run in a proxy  }
+  AP_FILTER_PROTO_NO_PROXY = $8;    
+{* Filter makes output non-cacheable  }
+  AP_FILTER_PROTO_NO_CACHE = $10;    
+{* Filter is incompatible with "Cache-Control: no-transform"  }
+  AP_FILTER_PROTO_TRANSFORM = $20;    
+{*
+ * @
+  }
+{skipped functions (macros)
+  function ap_fwrite(f,bb,data,nbyte : longint) : longint;
+  begin
+    ap_fwrite:=apr_brigade_write(bb,ap_filter_flush,f,data,nbyte);
+  end;
+
+  function ap_fputs(f,bb,str : longint) : longint;
+  begin
+    ap_fputs:=apr_brigade_puts(bb,ap_filter_flush,f,str);
+  end;
+
+  function ap_fputc(f,bb,c : longint) : longint;
+  begin
+    ap_fputc:=apr_brigade_putc(bb,ap_filter_flush,f,c);
+  end;
+}
+