about summary refs log tree commit diff
path: root/configure
blob: 8e2801ffbdbcc67b6893550490df3fb10eeaa5ac (plain)
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
#!/bin/sh

usage()
{
    echo "Use environment variables to pass values:
    CC         - compiler (default: cc)
    CFLAGS     - flags for compiler
    LDFLAGS    - flags for linker
    DESTDIR    - path to make install (default: /usr/local)
    NOSOCK     - set to cut part of libhttpc that works with sockets"
    exit 1
}

while test $# -gt 0; do
    case "$1" in
        -h) usage
            ;;
        --help) usage
            ;;
    esac
    shift
done

CC=${CC:-cc}
CFLAGS=${CFLAGS:-}
LDFLAGS=${LDFLAGS:-}
DESTDIR=${DESTDIR:-/usr/local}

echo "Configuration:
    Compiler: $CC
    CFLAGS: $CFLAGS
    LDFLAGS: $LDFLAGS
    DESTDIR: $DESTDIR"
if [ -z "${NOSOCK+x}" ]; then
    echo "    Will be built with sockets"
else
    echo "    Will be built without sockets"
fi

echo "
CFLAGS=$CFLAGS
LDFLAGS=$LDFLAGS
DESTDIR=$DESTDIR
" > config.mk

echo "#ifndef __LIBHTTPC_CONFIG_H__
#define __LIBHTTPC_CONFIG_H__

" > include/config.h
if [ -z "${NOSOCK+x}" ]; then
    echo "#define LibHTTPC_SOCK" >> include/config.h
fi
echo "
#endif" >> include/config.h