forked from dchest/reop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure
52 lines (46 loc) · 1.23 KB
/
configure
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
#!/bin/sh
has() {
header=/usr/include/$1
[ -f $header ] && grep -q $2 $header
}
doconfigure() {
printf 'CPPFLAGS=-I/usr/include -I/usr/local/include -Iother\n'
printf 'CFLAGS=-std=c99 -Wall -O2\n'
printf 'LDFLAGS=-L/usr/local/lib -lsodium\n'
printf 'OBJS=reop.o\n'
printf 'OBJS+=main.o\n'
# always include base64.c. testing for correct versions is too hard
printf 'OBJS+=other/base64.o\n'
if has features.h _GNU_SOURCE ; then
printf 'CPPFLAGS+=-D_GNU_SOURCE\n'
fi
if ! has string.h strlcpy ; then
printf 'OBJS+=other/strlcpy.o\n'
printf 'CPPFLAGS+=-DNEED_STRLCPY\n'
fi
if ! has string.h strlcat ; then
printf 'OBJS+=other/strlcat.o\n'
printf 'CPPFLAGS+=-DNEED_STRLCAT\n'
fi
if ! has readpassphrase.h readpassphrase ; then
printf 'OBJS+=other/readpassphrase.o\n'
fi
if has util.h bcrypt_pbkdf ; then
printf 'LDFLAGS+=-lutil\n'
else
printf 'OBJS+=other/bcrypt_pbkdf.o\n'
if ! has blf.h Blowfish_initstate ; then
printf 'OBJS+=other/blowfish.o\n'
fi
fi
printf '\n'
printf '.c.o:\n'
printf '\t${CC} ${CFLAGS} ${CPPFLAGS} -o $@ -c $<\n'
printf '\n'
printf 'reop: ${OBJS}\n'
printf '\t${CC} ${OBJS} -o reop ${LDFLAGS}\n'
printf '\n'
printf 'clean:\n'
printf '\trm -f ${OBJS} reop\n'
}
doconfigure > Makefile