-
Notifications
You must be signed in to change notification settings - Fork 8
/
configure
executable file
·151 lines (133 loc) · 4.02 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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
#!/bin/sh
prefix=/usr/local
opt=true
dbg=true
plugins=`cd plugins && find . -type d | awk -F / '{print $2}' | sort | uniq`
dislist=
disable_plugin()
{
plugins=`echo $plugins | sed "s/$1//;s/ / /"`
dislist="$dislist $1"
}
for arg; do
case $arg in
--prefix=*)
prefix=`echo $arg | sed 's/--prefix=//'`
;;
--enable-opt)
opt=true
;;
--disable-opt)
opt=false
;;
--enable-dbg)
dbg=true
;;
--disable-dbg)
dbg=false
;;
--disable-plugin-*)
disable_plugin `echo $arg | sed 's/--disable-plugin-//'`
;;
--help)
echo 'Usage: ./configure [options]'
echo 'Options:'
echo ' --prefix=<prefix> installation prefix (default: /usr/local)'
echo ' --enable-opt enable code optimizations (default)'
echo ' --disable-opt disable code optimizations'
echo ' --enable-dbg enable debugging (default)'
echo ' --disable-dbg disable debugging'
echo ' --disable-plugin-<name> remove wallpaper plugin from build'
echo ' --help print usage and exit'
echo
echo 'You may set CFLAGS and/or LDFLAGS when running configure, to pass extra'
echo 'flags to the compiler and/or linker.'
echo
exit 0
;;
esac
done
check_header()
{
definc='-I/usr/local/include -I/usr/X11R6/include'
if echo "#include <$2>" | cpp $definc $CFLAGS >/dev/null 2>&1; then
echo "Looking for $2 ... OK"
eval have_$1=true
return 0
else
echo "Looking for $2 ... not found"
eval have_$1=false
return 1
fi
}
check_header alloca alloca.h
check_header xrandr X11/extensions/Xrandr.h || \
echo "libXrandr is an optional dependency, but it's highly recommended to install it and re-run configure, if possible."
check_header png png.h || exit 1
check_header jpeg jpeglib.h || exit 1
check_header motif Xm/Xm.h || \
echo "motif library not found, won't be able to build xlivebg-gui. Install motif and re-run configure, if you want the GUI."
echo
echo "Enabled plugins: $plugins"
echo
echo "Disabled plugins:$dislist"
echo
echo 'Generating Makefile ...'
echo '# Generated by configure, do not edit. Edit Makefile.in instead' >Makefile
echo "PREFIX = $prefix" >>Makefile
[ -n "$CFLAGS" ] && echo "CFLAGS_cfg = $CFLAGS" >>Makefile
[ -n "$LDFLAGS" ] && echo "LDFLAGS_cfg = $LDFLAGS" >>Makefile
$opt && echo 'opt = -O3' >>Makefile
if $dbg; then
echo 'dbg = -g' >>Makefile
else
echo 'dbg = -DNDEBUG' >>Makefile
fi
if [ `uname -s` != OpenBSD ]; then
echo 'libdl = -ldl' >>Makefile
fi
if $have_alloca; then
echo 'CFLAGS_alloca = -DHAVE_ALLOCA_H' >>Makefile
fi
if $have_xrandr; then
echo 'CFLAGS_xrandr = -DHAVE_XRANDR' >>Makefile
echo 'LDFLAGS_xrandr = -lXrandr' >>Makefile
fi
if $have_motif; then
echo 'gui_target = gui' >>Makefile
fi
cat Makefile.in >>Makefile
echo 'Generating plugins/Makefile ...'
echo '# Generated by configure, do not edit.' >plugins/Makefile
if [ -n "$CFLAGS" ]; then
echo "CFLAGS_cfg = $CFLAGS" >>plugins/Makefile
echo 'export CFLAGS_cfg' >>plugins/Makefile
fi
if [ -n "$LDFLAGS" ]; then
echo "LDFLAGS_cfg = $LDFLAGS" >>plugins/Makefile
echo 'export LDFLAGS_cfg' >>plugins/Makefile
fi
echo '.PHONY: all clean install uninstall' >>plugins/Makefile
echo "all: `echo $plugins`" >>plugins/Makefile
echo "clean: `echo $plugins | sed 's/\(^\| \)/ clean-/g'`" >>plugins/Makefile
echo "install: `echo $plugins | sed 's/\(^\| \)/ install-/g'`" >>plugins/Makefile
echo "uninstall: `echo $plugins | sed 's/\(^\| \)/ uninstall-/g'`" >>plugins/Makefile
echo >>plugins/Makefile
for i in $plugins; do
echo "# $i plugin" >>plugins/Makefile
echo ".PHONY: $i clean-$i install-$i uninstall-$i" >>plugins/Makefile
echo "$i:" >>plugins/Makefile
echo " \$(MAKE) -C $i" >>plugins/Makefile
echo >>plugins/Makefile
echo "clean-$i:" >>plugins/Makefile
echo " \$(MAKE) -C $i clean" >>plugins/Makefile
echo >>plugins/Makefile
echo "install-$i:" >>plugins/Makefile
echo " \$(MAKE) -C $i install" >>plugins/Makefile
echo >>plugins/Makefile
echo "uninstall-$i:" >>plugins/Makefile
echo " \$(MAKE) -C $i uninstall" >>plugins/Makefile
echo >>plugins/Makefile
done
echo $0 $* >config.prev
chmod 777 config.prev