Hello,
I downloaded the latest snapshot of APR and I fixed it under Mingw+MSys.

Description of changes:

(1) libtool does not work if $top_builddir is undefined.

(2) I cannot really understand why the configure script made this crap:

Checking for libraries...
checking for getpid in -lmsvcrt... yes
checking for [EMAIL PROTECTED] in kernel32... yes
checking for [EMAIL PROTECTED] in advapi32... yes
checking for [EMAIL PROTECTED] in ws2_32... yes
checking for [EMAIL PROTECTED] in shell32... yes
checking for [EMAIL PROTECTED] in kernel32... yes
checking for [EMAIL PROTECTED] in rpcrt4... yes

You must never add kernel32 or user32 directly on the command line!
You must leave the decision to Mingw if they must be used or not.
If you add them manually on Mingw, it may happen a disaster.
So, I just added the libraries we need.

(3) I saw you enabled a feature by checking if [EMAIL PROTECTED] is found.
Actually this is an useless test, because there is no doubt that this function 
is available under Win32/Win64.
At them moment I simply made "ac_cv_func_CreateFileMapping=yes" for detecting 
right mode with Mingw.
Perhaps you may prefer a different or more clean coding style, I just wanted to 
show you the right direction.

(4) I added "-no-undefined" to the options of libtool, otherwise it cannot 
create shared libraries under mingw and cygwin.

(5) I added dependency to tlhelp32.h for fixing the error at compile time about 
missing PROCESS32 stuff.
I think it's also better to move the test for windows.h and winsock2.h here.

Sincerely,

Carlo Bramini.

---------- Initial Header -----------

>From      : "William A. Rowe, Jr." [EMAIL PROTECTED]
To          : [email protected]
Cc          :
Date      : Sun, 27 Jul 2008 19:22:43 -0500
Subject : Re: apr 1.3.2 compile fails with mingw/gcc

> Bob Rossi wrote:
> >>
> >> In file included from 
> >> apr/apr-1.3.2/apr-1.3.2/include/arch/win32/apr_arch_file_io.h:29,
> >>                  from dso/win32/dso.c:20:
> >> apr/apr-1.3.2/apr-1.3.2/include/arch/win32/apr_arch_misc.h:419: error: 
> >> expected declaration specifiers or '...' before 'LPPROCESSENTRY32W'
> >> apr/apr-1.3.2/apr-1.3.2/include/arch/win32/apr_arch_misc.h:419: error: 
> >> expected declaration specifiers or '...' before 'LPPROCESSENTRY32W'
> >> apr/apr-1.3.2/apr-1.3.2/include/arch/win32/apr_arch_misc.h: In function 
> >> 'apr_winapi_Process32FirstW':
> >> apr/apr-1.3.2/apr-1.3.2/include/arch/win32/apr_arch_misc.h:419: error: 
> >> 'lppe' undeclared (first use in this function)
> >> apr/apr-1.3.2/apr-1.3.2/include/arch/win32/apr_arch_misc.h:419: error: 
> >> (Each undeclared identifier is reported only once
> >> apr/apr-1.3.2/apr-1.3.2/include/arch/win32/apr_arch_misc.h:419: error: for 
> >> each function it appears in.)
> >> apr/apr-1.3.2/apr-1.3.2/include/arch/win32/apr_arch_misc.h:419: error: too 
> >> many arguments to function 'apr_winapi_pfn_Process32FirstW'
> >>
> >> Is this a known issue? I can give more details if not.
> >
> > Ping. Anything I can do to help?
>
> Well, it seems LPPROCESSENTRY32W is undefined, and I can't tell you why.
> Perhaps grep your includes to determine if there is a mingw specific include
> we needed?  It's got to be somewhere, that's a pretty old type.
>
> Are your certain your toolchain is up to date?
>
>
diff -r -u apr_20080728041423-old/build/apr_rules.mk.in 
apr_20080728041423-new/build/apr_rules.mk.in
--- apr_20080728041423-old/build/apr_rules.mk.in        Fri Jul 11 07:43:30 2008
+++ apr_20080728041423-new/build/apr_rules.mk.in        Mon Jul 28 12:46:56 2008
@@ -24,6 +24,7 @@
 #
 # Configuration variables
 #
[EMAIL PROTECTED]@
 [EMAIL PROTECTED]@
 [EMAIL PROTECTED]@
 
diff -r -u apr_20080728041423-old/configure.in 
apr_20080728041423-new/configure.in
--- apr_20080728041423-old/configure.in Fri Jul 11 07:43:44 2008
+++ apr_20080728041423-new/configure.in Mon Jul 28 11:37:22 2008
@@ -219,6 +219,9 @@
     *-solaris2*)
         apr_platform_runtime_link_flag="-R"
         ;;
+    *mingw* | *cygwin*)
+        LT_VERSION="$LT_VERSION -no-undefined"
+        ;;
     *)
         ;;
 esac
@@ -589,16 +592,22 @@
 dnl end up LIBS="-lm -lcrypt -lnsl  -ldl" which is an annoyance.
 case $host in
    *mingw* | *cygwin*)
-      dnl APR_ADDTO(LIBS,[-lmsvcrt --lshell32 -ladvapi32 -lws2_32])
-
+      AC_CHECK_HEADERS([windows.h winsock2.h])
+      AC_CHECK_HEADERS([tlhelp32.h], [], [], [
+        #ifdef HAVE_WINDOWS_H
+        #include <windows.h>
+        #endif
+      ])
       AC_CHECK_LIB(msvcrt, getpid)
-      APR_CHECK_DLL_FUNC(kernel32, [EMAIL PROTECTED])
-      APR_CHECK_DLL_FUNC(advapi32, [EMAIL PROTECTED])
-      APR_CHECK_DLL_FUNC(ws2_32, [EMAIL PROTECTED])
-      APR_CHECK_DLL_FUNC(shell32, [EMAIL PROTECTED])
-      APR_CHECK_DLL_FUNC(kernel32,[EMAIL PROTECTED],
-         [ac_cv_func_CreateFileMapping=$ac_cv_lib_kernel32_CreateFileMappingA])
-      APR_CHECK_DLL_FUNC(rpcrt4,[EMAIL PROTECTED])
+      APR_ADDTO(LIBS,[-lshell32 -ladvapi32 -lws2_32 -lrpcrt4])
+      ac_cv_func_CreateFileMapping=yes
+#      APR_CHECK_DLL_FUNC(kernel32, [EMAIL PROTECTED])
+#      APR_CHECK_DLL_FUNC(advapi32, [EMAIL PROTECTED])
+#      APR_CHECK_DLL_FUNC(ws2_32, [EMAIL PROTECTED])
+#      APR_CHECK_DLL_FUNC(shell32, [EMAIL PROTECTED])
+#      APR_CHECK_DLL_FUNC(kernel32,[EMAIL PROTECTED],
+#         
[ac_cv_func_CreateFileMapping=$ac_cv_lib_kernel32_CreateFileMappingA])
+#      APR_CHECK_DLL_FUNC(rpcrt4,[EMAIL PROTECTED])
       ;;
    *)
       AC_SEARCH_LIBS(gethostbyname, nsl)
@@ -789,7 +798,7 @@
 #endif";;
 esac
 
-AC_CHECK_HEADERS([sys/types.h sys/mman.h sys/ipc.h sys/mutex.h sys/shm.h 
sys/file.h kernel/OS.h os2.h windows.h])
+AC_CHECK_HEADERS([sys/types.h sys/mman.h sys/ipc.h sys/mutex.h sys/shm.h 
sys/file.h kernel/OS.h os2.h])
 AC_CHECK_FUNCS([mmap munmap shm_open shm_unlink shmget shmat shmdt shmctl \
                 create_area])
 
@@ -1122,6 +1131,7 @@
     unix.h             \
     windows.h          \
     winsock2.h         \
+    tlhelp32.h         \
     arpa/inet.h                \
     kernel/OS.h                \
     net/errno.h                \
@@ -1203,6 +1213,7 @@
 AC_SUBST(semaphoreh)
 AC_SUBST(windowsh)
 AC_SUBST(winsock2h)
+AC_SUBST(tlhelp32h)
 
 # Checking for h_errno in <netdb.h>
 if test "$netdbh" = "1"; then
diff -r -u apr_20080728041423-old/include/apr.h.in 
apr_20080728041423-new/include/apr.h.in
--- apr_20080728041423-old/include/apr.h.in     Fri Jul 11 07:43:20 2008
+++ apr_20080728041423-new/include/apr.h.in     Mon Jul 28 12:28:10 2008
@@ -107,6 +107,7 @@
 #define APR_HAVE_UNISTD_H        @unistdh@
 #define APR_HAVE_WINDOWS_H       @windowsh@
 #define APR_HAVE_WINSOCK2_H      @winsock2h@
+#define APR_HAVE_TLHELP32_H      @tlhelp32h@
 
 /** @} */
 /** @} */
@@ -116,11 +117,19 @@
  */
 
 #if APR_HAVE_WINDOWS_H
+/* Required for NTFS support */
+#ifndef _WIN32_WINNT
+#define _WIN32_WINNT 0x0500
+#endif
 #include <windows.h>
 #endif
 
 #if APR_HAVE_WINSOCK2_H
 #include <winsock2.h>
+#endif
+
+#if APR_HAVE_TLHELP32_H
+#include <tlhelp32.h>
 #endif
 
 #if APR_HAVE_SYS_TYPES_H

Reply via email to