summaryrefslogtreecommitdiffhomepage
path: root/configure
blob: 8923ba5bd30b69ed46526c0f43ff696d10b79522 (plain) (blame)
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
#!/bin/sh
set -eu

cflags() {
	echo "CFLAGS += $*"
}
ldlibs() {
	echo "LDLIBS ${o:-}= $*"
	o=+
}
def() {
	cflags "-D'$1=$2'"
}
obj() {
	echo "OBJS ${o:-}= $*"
	o=+
}

exec >config.mk

uname=$(uname)

case "${uname}" in
	(OpenBSD) echo "ETCDIR = /etc" ;;
esac

case "${uname}" in
	(FreeBSD|OpenBSD)
		echo "RC_SCRIPT = ${uname}/catsitd"
		echo 'install: install-rc'
		echo 'uninstall: uninstall-rc'
		;;
esac

for opt; do
	case "${opt}" in
		(--prefix=*) echo "PREFIX = ${opt#*=}" ;;
		(--sbindir=*) echo "SBINDIR = ${opt#*=}" ;;
		(--mandir=*) echo "MANDIR = ${opt#*=}" ;;
		(--sysconfdir=*) echo "ETCDIR = ${opt#*=}" ;;
		(*) echo "warning: unsupported option ${opt}" >&2 ;;
	esac
done

case "${uname}" in
	(Linux)
		cflags -Wno-pedantic -D_GNU_SOURCE -DNEED_COMPAT_LINUX -DNEED_SYS_SIGNAME
		def SIGINFO SIGUSR2
		obj compat_getprogname_linux.o compat_setproctitle_linux.o compat_sys_signame_linux.o
		cat <<'EOF'
compat_sys_signame_linux.c:
	sh ./compat_sys_signame_linux.sh > compat_sys_signame_linux.c

${OBJS}: compat_sys_signame_linux.c
EOF
		;;
esac