forked from 01micko/pmck
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure
executable file
·121 lines (109 loc) · 2.89 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
#!/bin/sh
#very simple configure script to generate Makefile
#defaults
PREFIX=/usr/local
BUILD=
build=static
#parameters
while [ $# != 0 ]; do
I=1
while [ $I -lt `echo $# | wc -c` ]; do
case $1 in
--prefix*) PREFIX=`echo $1|cut -d '=' -f2`;;
--libdir*) LIBDIR=`echo $1|cut -d '=' -f2`;;
--mandir*) MANDIR=`echo $1|cut -d '=' -f2`;;
--enable-shared*)BUILD=-D_SHARED_BUILD;build=shared;;
--enable-static*)BUILD='';build=static;FLAG=1;;
-h|--help) echo '
-h|--help show this help
--prefix=/dir set installation path : default /usr/local
--libdir= set lib dir : default '$PREFIX'/lib, eg: /usr/lib64
--enable-shared build with shared libpmdesktop.so : default no
--enable-static build with static pmdesktop.c : default yes
useful if libpmdesktop.so is installed to force static linking
--mandir= eg: /usr/man, default is '$PREFIX'/share/man'
exit;;
esac
shift
I=$(($I+1))
done
done
[ -z "$LIBDIR" ] && LIBDIR=${PREFIX}/lib
[ -z "$MANDIR" ] && MANDIR=${PREFIX}/share/man
echo
echo -n "checking for gcc... "
type gcc 2>&1 >/dev/null
if [ "$?" -eq 0 ];then echo "ok"
else echo -e "not found \naborting" && exit
fi
PM=`find /usr -type l -name libpmdesktop.so`
if [ "$PM" ];then
if [ "$build" = "static" -a -z "$FLAG" ];then
echo -n "ALERT: "
echo "${PM##*/} found"
echo "Static build is disabled"
echo
build=shared
BUILD=-D_SHARED_BUILD
fi
fi
if [ "$build" = "shared" ];then
echo -n "checking for libpmdesktop... "
if [ "$PM" ];then echo "ok"
EXTRALIBS='-lpmdesktop'
else echo -e "not found, please install libpmdesktop \nenabling static pmdesktop"
SHARED='
pmdesktop.o: pmdesktop.c
$(CC) -o $@ $(CFLAGS) -c $^
'
PMOBJ='pmdesktop.o'
build=static
BUILD=''
fi
else
SHARED='
pmdesktop.o: pmdesktop.c
$(CC) -o $@ $(CFLAGS) -c $^
'
PMOBJ='pmdesktop.o'
fi
echo
echo "======================="
echo "prefix: "$PREFIX"
libdir: "${LIBDIR}"
mandir: "${MANDIR}"
build: $build"
echo
echo "If these don't look right run $0 again"
cat > Makefile << _MAKE
CC=gcc
PREFIX=$PREFIX
LIBDIR=${LIBDIR}
MANDIR=${MANDIR}
CFLAGS=-Wall -pedantic -std=gnu99 -g
LIBFLAGS=-I/usr/include \`pkg-config --cflags cairo\`
LDFLAGS=-Wall -g -L\$(LIBDIR) -lX11 -lXext -lcairo
BUILD=$BUILD
EXTRALIBS=$EXTRALIBS
all: pmck
pmck: pmck.o $PMOBJ
\$(CC) -o \$@ \$^ \$(LDFLAGS) \$(EXTRALIBS)
pmck.o: pmck.c
\$(CC) -o \$@ \$(CFLAGS) \$(LIBFLAGS) \$(BUILD) -c \$^
${SHARED}
install: pmck
install -d -m 0755 \$(DESTDIR)\$(PREFIX)/bin \$(DESTDIR)\$(MANDIR)/man1/
install -d -m 0755 \$(DESTDIR)\$(PREFIX)/share/pmck
install -m 0755 -s pmck \$(DESTDIR)\$(PREFIX)/bin
install -m 0644 pmck.1 \$(DESTDIR)\$(MANDIR)/man1/pmck.1
install -m 0644 pmckrc \$(DESTDIR)\$(PREFIX)/share/pmck/pmckrc
uninstall: pmck
-rm \$(PREFIX)/bin/pmck
-rm \$(MANDIR)/man1/pmck.1
-rm -r \$(PREFIX)/share/pmck/
\$(info Manual cleanup of your ~/.config dir may be necessary)
clean:
-rm -f *.o pmck
distclean:
-rm Makefile
_MAKE