]> begriffs open source - libderp/blob - configure
Find Boehm faster on mac
[libderp] / configure
1 #!/bin/sh
2 set -eu
3
4 rm -f config.mk
5
6 cat > config.mk <<-EOF
7         VER=\`(cat VERSION)\`
8         MAJOR=\`(cut -d . -f 1 VERSION)\`
9         MINOR=\`(cut -d . -f 2 VERSION)\`
10 EOF
11
12 printf "Detecting shared object style: "
13 if [ "$(uname -s)" = Darwin ]
14 then
15         echo ".dylib"
16         cat >> config.mk <<-EOF
17                 SO = dylib
18                 SOFLAGS = -dynamiclib -install_name "libderp.\${MAJOR}.dylib" -current_version \${VER} -compatibility_version \${MAJOR}.\${MINOR}.0
19         EOF
20 else
21         echo ".so"
22         cat >> config.mk <<-EOF
23                 SO = so
24                 SOFLAGS = -shared -Wl,-soname,libderp.so.\${MAJOR}.\${MINOR}
25         EOF
26 fi
27
28 printf "Detecting Boehm GC for leak tests... "
29 GCLIB=`find /opt /usr/local -name 'libgc.*' -exec dirname {} \; 2>/dev/null | head -n 1`
30 GCINC=`find /opt /usr/local -name 'leak_detector.h' -exec dirname {} \; 2>/dev/null | head -n 1`
31
32 if [ -z "$GCLIB" -o -z "$GCINC" ]; then
33         echo "not found\n"
34         echo "Will not do memory leak checks in test suite"
35 else
36         echo "$GCLIB"
37         cat >> config.mk <<-EOF
38         EXTRA_DEV_CFLAGS  += -DHAVE_BOEHM_GC -I$GCINC/..
39         EXTRA_DEV_LDFLAGS += -L$GCLIB
40         EOF
41 fi