1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
$NetBSD: patch-libraries_base_configure.ac,v 1.1 2015/02/04 06:53:18 pho Exp $
Do not clobber CPPFLAGS nor LDFLAGS:
When we are using pkgsrc converters/libiconv, we have libiconv.so in
${PREFIX}/lib and "-Wl,-R${PREFIX}/lib" in LDFLAGS. In this case
FP_SEARCH_LIBS_PROTO(iconv) appends "-liconv" to $LIBS so it will be
linked to any conftest executables that follow, including one which
will be generated by AC_CHECK_SIZEOF().
The problem that if libraries listed in $LIBS are in a non-standard
path while rpath flags are missing (due to LDFLAGS being clobbered in
this case), conftest executables cannot run even if they can be
linked. And if anything goes wrong during AC_CHECK_SIZEOF(T), it
considers sizeof(T) as 0 unless T is known to be an existing type.
...
checking for library containing iconv... -liconv
checking for library containing locale_charset... none required
checking size of struct MD5Context... 0
...
This means SIZEOF_STRUCT_MD5CONTEXT is defined to 0,
GHC.Fingerprint.fingerprintData allocates 0 bytes on the heap,
MD5Init/Update/Final corrupts the heap and then Bad Things will
happen.
--- libraries/base/configure.ac.orig 2013-04-18 21:30:14.000000000 +0000
+++ libraries/base/configure.ac
@@ -70,13 +70,13 @@ dnl-------------------------------------
AC_ARG_WITH([iconv-includes],
[AC_HELP_STRING([--with-iconv-includes],
[directory containing iconv.h])],
- [ICONV_INCLUDE_DIRS=$withval; CPPFLAGS="-I$withval"],
+ [ICONV_INCLUDE_DIRS=$withval; CPPFLAGS="-I$withval $CPPFLAGS"],
[ICONV_INCLUDE_DIRS=])
AC_ARG_WITH([iconv-libraries],
[AC_HELP_STRING([--with-iconv-libraries],
[directory containing iconv library])],
- [ICONV_LIB_DIRS=$withval; LDFLAGS="-L$withval"],
+ [ICONV_LIB_DIRS=$withval; LDFLAGS="-L$withval $LDFLAGS"],
[ICONV_LIB_DIRS=])
AC_SUBST(ICONV_INCLUDE_DIRS)
@@ -183,7 +183,10 @@ fi
# Hack - md5.h needs HsFFI.h. Is there a better way to do this?
CFLAGS="-I../../includes $CFLAGS"
-AC_CHECK_SIZEOF([struct MD5Context], ,[#include "include/md5.h"])
+dnl Calling AC_CHECK_TYPE(T) makes AC_CHECK_SIZEOF(T) abort on failure
+dnl instead of considering sizeof(T) as 0.
+AC_CHECK_TYPE([struct MD5Context], [], [], [#include "include/md5.h"])
+AC_CHECK_SIZEOF([struct MD5Context], [], [#include "include/md5.h"])
AC_SUBST(EXTRA_LIBS)
AC_CONFIG_FILES([base.buildinfo])
|