You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by je...@apache.org on 2006/07/12 00:19:41 UTC
svn commit: r421013 - in /apr/apr/trunk: build/apr_hints.m4
build/apr_win32.m4 configure.in
Author: jerenkrantz
Date: Tue Jul 11 15:19:40 2006
New Revision: 421013
URL: http://svn.apache.org/viewvc?rev=421013&view=rev
Log:
Allow configure to complete successfully on mingw.
Originally titled: [patch 02/17] Windows library dependencies
---
Windows symbols may a suffix of @<arg count>.
A new macro APR_CHECK_DLL_FUNC looks for a @ sign in the function name; when
present it will verify a symbol exists with the correct argument count.
Otherwise, APR_CHECK_DLL_FUNC falls back to emulating AC_CHECK_LIB.
Enables native threads, locking, DSO loading and shared memory.
---
Submitted by: John Mark Vandenberg
Tweaked by: Justin Erenkrantz
Added:
apr/apr/trunk/build/apr_win32.m4
Modified:
apr/apr/trunk/build/apr_hints.m4
apr/apr/trunk/configure.in
Modified: apr/apr/trunk/build/apr_hints.m4
URL: http://svn.apache.org/viewvc/apr/apr/trunk/build/apr_hints.m4?rev=421013&r1=421012&r2=421013&view=diff
==============================================================================
--- apr/apr/trunk/build/apr_hints.m4 (original)
+++ apr/apr/trunk/build/apr_hints.m4 Tue Jul 11 15:19:40 2006
@@ -422,6 +422,9 @@
*cygwin*)
APR_ADDTO(CPPFLAGS, [-DCYGWIN])
;;
+ *mingw*)
+ APR_ADDTO(LDFLAGS, [-Wl,--enable-auto-import,--subsystem,console])
+ ;;
esac
fi
Added: apr/apr/trunk/build/apr_win32.m4
URL: http://svn.apache.org/viewvc/apr/apr/trunk/build/apr_win32.m4?rev=421013&view=auto
==============================================================================
--- apr/apr/trunk/build/apr_win32.m4 (added)
+++ apr/apr/trunk/build/apr_win32.m4 Tue Jul 11 15:19:40 2006
@@ -0,0 +1,33 @@
+
+dnl if $2 contains '@dd', links against mingw symbols
+dnl otherwise calls AC_CHECK_LIB
+AC_DEFUN([APR_CHECK_DLL_FUNC],[
+m4_define($1_function_name,m4_substr($2,0,m4_index($2,[@])))
+m4_define($1_function_arglength,m4_substr($2,m4_incr(m4_index($2,[@]))))
+m4_define($1_[function_name]_arglength,m4_substr($2,m4_incr(m4_index($2,[@]))))
+dnl m4_define(apr_check_dll_id,$1_m4_defn($1_function_name))
+
+AC_CACHE_CHECK([for $2 in $1],[ac_cv_lib_$1_]$1_function_name,[
+
+ac_func_search_save_LIBS=$LIBS
+LIBS="$LIBS -l$1"
+
+AC_TRY_LINK([
+#pragma pack(1)
+struct x {
+]m4_for([byte_id], 1, m4_defn([$1_function_name_arglength]), 1,[[ char c]]byte_id;
+)[};
+__stdcall ]$1_function_name[(]struct x[);],[
+struct x s = {0};
+]$1_function_name[(s)],
+[ac_cv_lib_$1_]$1_function_name[=yes],[ac_cv_lib_$1_]$1_function_name[=no])
+LIBS=$ac_func_search_save_LIBS
+])dnl AC_CACHE_CHECK
+
+AS_IF([test $ac_cv_lib_$1_]$1_function_name[ = yes],
+ [m4_default([$3], [AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_LIB$1),,Enable if this library is available)
+ LIBS="-l$1 $LIBS"
+])],
+ [$4])dnl
+])
+
Modified: apr/apr/trunk/configure.in
URL: http://svn.apache.org/viewvc/apr/apr/trunk/configure.in?rev=421013&r1=421012&r2=421013&view=diff
==============================================================================
--- apr/apr/trunk/configure.in (original)
+++ apr/apr/trunk/configure.in Tue Jul 11 15:19:40 2006
@@ -16,6 +16,7 @@
sinclude(build/apr_common.m4)
sinclude(build/apr_network.m4)
sinclude(build/apr_threads.m4)
+sinclude(build/apr_win32.m4)
sinclude(build/apr_hints.m4)
sinclude(build/libtool.m4)
sinclude(build/ltsugar.m4)
@@ -404,6 +405,12 @@
OSDIR="as400"
eolstr="\\n"
;;
+ *mingw*)
+ OSDIR="win32"
+ enable_threads="system_threads"
+ eolstr="\\n"
+ OBJECTS_PLATFORM='$(OBJECTS_win32)'
+ ;;
*cygwin*)
OSDIR="unix"
APR_ADDTO(CPPFLAGS,-DCYGWIN)
@@ -520,12 +527,27 @@
dnl It should check for LIBS being empty and set LIBS equal to the new value
dnl without the extra " " in that case, but they didn't do that. So, we
dnl end up LIBS="-lm -lcrypt -lnsl -ldl" which is an annoyance.
-AC_SEARCH_LIBS(gethostbyname, nsl)
-AC_SEARCH_LIBS(gethostname, nsl)
-AC_SEARCH_LIBS(socket, socket)
-AC_SEARCH_LIBS(crypt, crypt ufc)
-AC_CHECK_LIB(truerand, main)
-AC_SEARCH_LIBS(modf, m)
+case $host in
+ *mingw*)
+ dnl APR_ADDTO(LIBS,[-lmsvcrt --lshell32 -ladvapi32 -lws2_32])
+
+ AC_CHECK_LIB(msvcrt, getpid)
+ APR_CHECK_DLL_FUNC(kernel32, SetErrorMode@4)
+ APR_CHECK_DLL_FUNC(advapi32, GetSecurityInfo@32)
+ APR_CHECK_DLL_FUNC(ws2_32, gethostbyname@4)
+ APR_CHECK_DLL_FUNC(shell32, CommandLineToArgvW@8)
+ APR_CHECK_DLL_FUNC(kernel32,[CreateFileMappingA@24],
+ [ac_cv_func_CreateFileMapping=$ac_cv_lib_kernel32_CreateFileMappingA])
+ ;;
+ *)
+ AC_SEARCH_LIBS(gethostbyname, nsl)
+ AC_SEARCH_LIBS(gethostname, nsl)
+ AC_SEARCH_LIBS(socket, socket)
+ AC_SEARCH_LIBS(crypt, crypt ufc)
+ AC_CHECK_LIB(truerand, main)
+ AC_SEARCH_LIBS(modf, m)
+ ;;
+esac
dnl ----------------------------- Checking for Threads
echo "${nl}Checking for Threads..."
@@ -698,9 +720,10 @@
#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])
+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_FUNCS([mmap munmap shm_open shm_unlink shmget shmat shmdt shmctl \
create_area])
+
APR_CHECK_DEFINE(MAP_ANON, sys/mman.h)
APR_CHECK_FILE(/dev/zero)
@@ -760,6 +783,10 @@
[havebeosshm="1"
APR_DECIDE(USE_SHMEM_BEOS_ANON,
[BeOS areas])])
+APR_IFALLYES(header:windows.h func:CreateFileMapping,
+ [havewin32shm="1"
+ APR_DECIDE(USE_SHMEM_WIN32_ANON,
+ [Windows CreateFileMapping()])])
case $host in
*linux* )
# Linux has problems with MM_SHMT_MMANON even though it reports
@@ -806,6 +833,7 @@
haveshmget="0"
havebeosarea="0"
haveos2shm="0"
+havewin32shm="0"
APR_BEGIN_DECISION([namebased memory allocation method])
APR_IFALLYES(header:sys/mman.h func:mmap func:munmap,
[havemmaptmp="1"
@@ -826,6 +854,9 @@
APR_IFALLYES(header:os2.h,
[haveos2shm="1"
APR_DECIDE(USE_SHMEM_OS2, [OS/2 DosAllocSharedMem()])])
+APR_IFALLYES(header:windows.h,
+ [havewin32shm="1"
+ APR_DECIDE(USE_SHMEM_WIN32, [Windows shared memory])])
case $host in
*linux* )
# Linux has problems with MM_SHMT_MMANON even though it reports
@@ -846,6 +877,7 @@
useshmget="0"
usebeosarea="0"
useos2shm="0"
+usewin32shm="0"
case $ac_decision in
USE_SHMEM_MMAP_TMP )
@@ -863,10 +895,13 @@
USE_SHMEM_OS2 )
useos2shm="1"
;;
+ USE_SHMEM_WIN32 )
+ usewin32shm="1"
+ ;;
esac
# Do we have any shared memory support?
-if test "$usemmaptmp$usemmapshm$usemmapzero$useshmget$usemmapanon$usebeosarea$useos2shm" = "0000000"; then
+if test "$usemmaptmp$usemmapshm$usemmapzero$useshmget$usemmapanon$usebeosarea$useos2shm$usewin32shm" = "00000000"; then
sharedmem="0"
else
sharedmem="1"
@@ -877,11 +912,13 @@
AC_SUBST(useshmget)
AC_SUBST(usebeosarea)
AC_SUBST(useos2shm)
+AC_SUBST(usewin32shm)
AC_SUBST(havemmaptmp)
AC_SUBST(havemmapshm)
AC_SUBST(haveshmget)
AC_SUBST(havebeosarea)
AC_SUBST(haveos2shm)
+AC_SUBST(havewin32shm)
AC_SUBST(sharedmem)
dnl ----------------------------- Checks for Any required Functions
@@ -1462,7 +1499,7 @@
# Everything else:
if test "$dsotype" = "any"; then
case $host in
- *os390|*-os2*|*os400|*-aix*) dsotype=other ;;
+ *os390|*-os2*|*os400|*-aix*|*mingw*) dsotype=other ;;
esac
fi
fi
@@ -1658,6 +1695,11 @@
if test "x$apr_lock_method" != "x"; then
APR_DECISION_FORCE($apr_lock_method)
fi
+case "$host" in
+ *mingw* )
+ APR_DECISION_FORCE(win32)
+ ;;
+esac
APR_END_DECISION
AC_DEFINE_UNQUOTED($ac_decision)