AS_CASE(["$squid_host_os"],
[mingw],[
- AC_PATH_PROG(WIN32_PSAPI, psapi.dll, none)
CFLAGS="$CFLAGS -mthreads"
CXXFLAGS="$CXXFLAGS -mthreads -static-libgcc -static-libstdc++"
- AS_IF([test "x$ac_cv_path_WIN32_PSAPI" = "xnone"],[
- AC_MSG_NOTICE([PSAPI.DLL is recommended to run Squid on Windows NT Platform])
- AC_MSG_NOTICE([Please see PSAPI.DLL section on doc/win32-relnotes.html.])
- ],[
- AC_DEFINE(HAVE_WIN32_PSAPI,1,[Define if you have PSAPI.DLL on Windows systems])
- LIBS="$LIBS -lpsapi"
- ])
MINGW_LIBS="-lmingwex"
AC_SUBST(MINGW_LIBS)
],
SQUID_STATE_ROLLBACK(LIBATOMIC)
AC_SUBST(ATOMICLIB)
+SQUID_AUTO_LIB(psapi,[Windows PSAPI.dll],[LIBPSAPI])
+AS_IF([test "x$with_psapi" != "xno"],[
+ SQUID_STATE_SAVE(squid_psapi_state)
+ CPPFLAGS="$LIBPSAPI_CFLAGS $CPPFLAGS"
+ LIBS="$LIBPSAPI_PATH $LIBS"
+ AC_CHECK_LIB([psapi],[K32GetProcessMemoryInfo],[LIBPSAPI_LIBS="-lpsapi"])
+ AC_CHECK_HEADER([psapi.h],,,[
+#if HAVE_WINDOWS_H
+#include <windows.h>
+#endif
+ ])
+ SQUID_STATE_ROLLBACK(squid_psapi_state)
+ AS_IF([test "x$LIBPSAPI_LIBS" != "x"],[
+ CXXFLAGS="$LIBPSAPI_CFLAGS $CXXFLAGS"
+ LIBPSAPI_LIBS="$LIBPSAPI_PATH $LIBPSAPI_LIBS"
+ ],[test "x$with_psapi" = "xyes"],[
+ AC_MSG_ERROR([Required library PSAPI.dll not found])
+ ],[
+ AC_MSG_NOTICE([Library PSAPI.dll not found.])
+ ])
+])
+AC_MSG_NOTICE([Using Windows PSAPI.dll library: ${with_psapi:=auto}])
+AC_SUBST(LIBPSAPI_LIBS)
+
AC_SEARCH_LIBS([shm_open], [rt])
AS_IF([test "x$ac_cv_search_shm_open" != "xno"],[
AC_DEFINE(HAVE_SHM,1,[Support shared memory features])
#endif
])
-dnl Override rusage() detect on MinGW because is emulated in source code
-AS_IF([test "$squid_host_os" = "mingw"],[
- AC_DEFINE(HAVE_STRUCT_RUSAGE)
- ac_cv_func_getrusage="yes"
- AC_MSG_NOTICE([Using own rusage on Windows.])
-],[
- AC_CHECK_TYPE(struct rusage,AC_DEFINE(HAVE_STRUCT_RUSAGE,1,[The system provides struct rusage]),,[
+AC_CHECK_TYPE(struct rusage,AC_DEFINE(HAVE_STRUCT_RUSAGE,1,[The system provides struct rusage]),,[
#if HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
#if HAVE_SYS_RESOURCE_H
#include <sys/resource.h>
#endif
- ])
])
AC_CHECK_MEMBERS([struct iphdr.ip_hl],,,[
#if HAVE_PRIV_H
#include <priv.h>
#endif
-#if HAVE_WIN32_PSAPI
+#if HAVE_PSAPI_H
#include <psapi.h>
#endif
#if HAVE_SYS_STAT_H
squid_getrusage(struct rusage *r)
{
memset(r, '\0', sizeof(struct rusage));
-#if HAVE_GETRUSAGE && defined(RUSAGE_SELF) && !_SQUID_WINDOWS_
+#if HAVE_GETRUSAGE && defined(RUSAGE_SELF)
#if _SQUID_SOLARIS_
/* Solaris 2.5 has getrusage() permission bug -- Arjan de Vet */
enter_suid();
leave_suid();
#endif
-#elif _SQUID_WINDOWS_ && HAVE_WIN32_PSAPI
+#elif defined(PSAPI_VERSION)
// Windows has an alternative method if there is no POSIX getrusage defined.
if (WIN32_OS_version >= _WIN_OS_WINNT) {
/* On Windows NT and later call PSAPI.DLL for process Memory */