summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRalph Giles <giles@ghostscript.com>2009-08-26 09:44:16 -0700
committerJeff Muizelaar <jmuizelaar@mozilla.com>2009-08-26 09:44:16 -0700
commit8319a3961ab1e7c8d58a4874f55f1986f2615a39 (patch)
tree8c23d45b6a37a9c0e37634c748d29b0125910578
parentd978a7a421dfe2e7afede5e4b29a730f9005344d (diff)
Build fix for linux (Fedora 11 on x86_64).
The malloc_test unit uses dlsym with RTLD_NEXT to find the libc's malloc function and substitute if no replacement is linked in. However, this define is a GNU extension, and so the source must define _GNU_SOURCE before including dlfcn.h. The dlsym function and friends also require linking with -ldl on Linux.
-rw-r--r--Makefile2
-rw-r--r--malloc-fail.c2
2 files changed, 3 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 40d6885..b5880cc 100644
--- a/Makefile
+++ b/Makefile
@@ -4,7 +4,7 @@
OPT_FLAGS=-O0
OPT_FLAGS=
CFLAGS=-Wall $(OPT_FLAGS) $(COVERAGE_FLAGS) -Wdeclaration-after-statement -ggdb `pkg-config --cflags lcms`
-LDFLAGS=`pkg-config --libs lcms`
+LDFLAGS=`pkg-config --libs lcms` -ldl
QCMS_SRC=iccread.c transform.c
QCMS_OBJS=iccread.o transform.o
diff --git a/malloc-fail.c b/malloc-fail.c
index a196a00..ed93b1e 100644
--- a/malloc-fail.c
+++ b/malloc-fail.c
@@ -1,3 +1,5 @@
+#define _GNU_SOURCE
+
#include <stdlib.h>
#include <assert.h>
#include <dlfcn.h>