Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit a534728

Browse files
committed
Only build in crashdump support on Windows if there's a working dbghelp.h.
1 parent 85cff3c commit a534728

File tree

7 files changed

+147
-2
lines changed

7 files changed

+147
-2
lines changed

configure

+123
Original file line numberDiff line numberDiff line change
@@ -667,6 +667,7 @@ PTHREAD_CFLAGS
667667
PTHREAD_LIBS
668668
PTHREAD_CC
669669
acx_pthread_config
670+
have_win32_dbghelp
670671
HAVE_IPV6
671672
LIBOBJS
672673
OSSP_UUID_LIBS
@@ -20926,6 +20927,128 @@ cat >>confdefs.h <<\_ACEOF
2092620927
#define HAVE_SYMLINK 1
2092720928
_ACEOF
2092820929

20930+
{ $as_echo "$as_me:$LINENO: checking for MINIDUMP_TYPE" >&5
20931+
$as_echo_n "checking for MINIDUMP_TYPE... " >&6; }
20932+
if test "${ac_cv_type_MINIDUMP_TYPE+set}" = set; then
20933+
$as_echo_n "(cached) " >&6
20934+
else
20935+
ac_cv_type_MINIDUMP_TYPE=no
20936+
cat >conftest.$ac_ext <<_ACEOF
20937+
/* confdefs.h. */
20938+
_ACEOF
20939+
cat confdefs.h >>conftest.$ac_ext
20940+
cat >>conftest.$ac_ext <<_ACEOF
20941+
/* end confdefs.h. */
20942+
20943+
#define WIN32_LEAN_AND_MEAN
20944+
#include <windows.h>
20945+
#include <string.h>
20946+
#include <dbghelp.h>
20947+
20948+
int
20949+
main ()
20950+
{
20951+
if (sizeof (MINIDUMP_TYPE))
20952+
return 0;
20953+
;
20954+
return 0;
20955+
}
20956+
_ACEOF
20957+
rm -f conftest.$ac_objext
20958+
if { (ac_try="$ac_compile"
20959+
case "(($ac_try" in
20960+
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
20961+
*) ac_try_echo=$ac_try;;
20962+
esac
20963+
eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
20964+
$as_echo "$ac_try_echo") >&5
20965+
(eval "$ac_compile") 2>conftest.er1
20966+
ac_status=$?
20967+
grep -v '^ *+' conftest.er1 >conftest.err
20968+
rm -f conftest.er1
20969+
cat conftest.err >&5
20970+
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
20971+
(exit $ac_status); } && {
20972+
test -z "$ac_c_werror_flag" ||
20973+
test ! -s conftest.err
20974+
} && test -s conftest.$ac_objext; then
20975+
cat >conftest.$ac_ext <<_ACEOF
20976+
/* confdefs.h. */
20977+
_ACEOF
20978+
cat confdefs.h >>conftest.$ac_ext
20979+
cat >>conftest.$ac_ext <<_ACEOF
20980+
/* end confdefs.h. */
20981+
20982+
#define WIN32_LEAN_AND_MEAN
20983+
#include <windows.h>
20984+
#include <string.h>
20985+
#include <dbghelp.h>
20986+
20987+
int
20988+
main ()
20989+
{
20990+
if (sizeof ((MINIDUMP_TYPE)))
20991+
return 0;
20992+
;
20993+
return 0;
20994+
}
20995+
_ACEOF
20996+
rm -f conftest.$ac_objext
20997+
if { (ac_try="$ac_compile"
20998+
case "(($ac_try" in
20999+
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
21000+
*) ac_try_echo=$ac_try;;
21001+
esac
21002+
eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
21003+
$as_echo "$ac_try_echo") >&5
21004+
(eval "$ac_compile") 2>conftest.er1
21005+
ac_status=$?
21006+
grep -v '^ *+' conftest.er1 >conftest.err
21007+
rm -f conftest.er1
21008+
cat conftest.err >&5
21009+
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
21010+
(exit $ac_status); } && {
21011+
test -z "$ac_c_werror_flag" ||
21012+
test ! -s conftest.err
21013+
} && test -s conftest.$ac_objext; then
21014+
:
21015+
else
21016+
$as_echo "$as_me: failed program was:" >&5
21017+
sed 's/^/| /' conftest.$ac_ext >&5
21018+
21019+
ac_cv_type_MINIDUMP_TYPE=yes
21020+
fi
21021+
21022+
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
21023+
else
21024+
$as_echo "$as_me: failed program was:" >&5
21025+
sed 's/^/| /' conftest.$ac_ext >&5
21026+
21027+
21028+
fi
21029+
21030+
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
21031+
fi
21032+
{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_MINIDUMP_TYPE" >&5
21033+
$as_echo "$ac_cv_type_MINIDUMP_TYPE" >&6; }
21034+
if test "x$ac_cv_type_MINIDUMP_TYPE" = x""yes; then
21035+
21036+
cat >>confdefs.h <<_ACEOF
21037+
#define HAVE_MINIDUMP_TYPE 1
21038+
_ACEOF
21039+
21040+
pgac_minidump_type=yes
21041+
else
21042+
pgac_minidump_type=no
21043+
fi
21044+
21045+
fi
21046+
if test x"$pgac_minidump_type" = x"yes" ; then
21047+
have_win32_dbghelp=yes
21048+
21049+
else
21050+
have_win32_dbghelp=no
21051+
2092921052
fi
2093021053

2093121054
if test "$with_readline" = yes; then

configure.in

+10
Original file line numberDiff line numberDiff line change
@@ -1350,6 +1350,16 @@ if test "$PORTNAME" = "win32"; then
13501350
AC_LIBOBJ(win32error)
13511351
AC_DEFINE([HAVE_SYMLINK], 1,
13521352
[Define to 1 if you have the `symlink' function.])
1353+
AC_CHECK_TYPES(MINIDUMP_TYPE, [pgac_minidump_type=yes], [pgac_minidump_type=no], [
1354+
#define WIN32_LEAN_AND_MEAN
1355+
#include <windows.h>
1356+
#include <string.h>
1357+
#include <dbghelp.h>])
1358+
fi
1359+
if test x"$pgac_minidump_type" = x"yes" ; then
1360+
AC_SUBST(have_win32_dbghelp,yes)
1361+
else
1362+
AC_SUBST(have_win32_dbghelp,no)
13531363
fi
13541364

13551365
if test "$with_readline" = yes; then

src/Makefile.global.in

+3
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,9 @@ ELF_SYSTEM= @ELF_SYS@
363363
# Backend stack size limit has to be hard-wired on Windows (it's in bytes)
364364
WIN32_STACK_RLIMIT=4194304
365365

366+
# Set if we have a working win32 crashdump header
367+
have_win32_dbghelp = @have_win32_dbghelp@
368+
366369
# Pull in platform-specific magic
367370
include $(top_builddir)/src/Makefile.port
368371

src/backend/main/main.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ main(int argc, char *argv[])
8585
* If supported on the current platform, set up a handler to be called if
8686
* the backend/postmaster crashes with a fatal signal or exception.
8787
*/
88-
#ifdef WIN32
88+
#if defined(WIN32) && defined(HAVE_MINIDUMP_TYPE)
8989
pgwin32_install_crashdump_handler();
9090
#endif
9191

src/backend/port/win32/Makefile

+4-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ subdir = src/backend/port/win32
1212
top_builddir = ../../../..
1313
include $(top_builddir)/src/Makefile.global
1414

15-
OBJS = timer.o socket.o signal.o security.o mingwcompat.o crashdump.o
15+
OBJS = timer.o socket.o signal.o security.o mingwcompat.o
16+
ifeq ($(have_win32_dbghelp), yes)
17+
OBJS += crashdump.o
18+
endif
1619

1720
include $(top_srcdir)/src/backend/common.mk

src/include/pg_config.h.in

+3
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,9 @@
342342
/* Define to 1 if you have the <memory.h> header file. */
343343
#undef HAVE_MEMORY_H
344344

345+
/* Define to 1 if the system has the type `MINIDUMP_TYPE'. */
346+
#undef HAVE_MINIDUMP_TYPE
347+
345348
/* Define to 1 if you have the <netinet/in.h> header file. */
346349
#undef HAVE_NETINET_IN_H
347350

src/include/pg_config.h.win32

+3
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,9 @@
258258
/* Define to 1 if you have the <memory.h> header file. */
259259
#define HAVE_MEMORY_H 1
260260

261+
/* Define to 1 if the system has the type `MINIDUMP_TYPE'. */
262+
#define HAVE_MINIDUMP_TYPE 1
263+
261264
/* Define to 1 if you have the <netinet/in.h> header file. */
262265
#define HAVE_NETINET_IN_H 1
263266

0 commit comments

Comments
 (0)