-
Notifications
You must be signed in to change notification settings - Fork 11
/
configure.ac
231 lines (196 loc) · 6.67 KB
/
configure.ac
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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
# $Id$
# vim:ft=m4
AC_INIT([stalonetray],[0.8.5])
AC_CONFIG_SRCDIR(src/main.c)
AC_CONFIG_HEADERS(src/config.h)
AM_INIT_AUTOMAKE([foreign])
dnl ============ General =============
AC_PROG_CC
AC_USE_SYSTEM_EXTENSIONS
AC_CHECK_HEADERS([ctype.h],,[AC_MSG_FAILURE([ctype.h is not found.])])
AC_CHECK_HEADERS([errno.h],,[AC_MSG_FAILURE([errno.h is not found.])])
AC_CHECK_HEADERS([signal.h],,[AC_MSG_FAILURE([signal.h is not found.])])
AC_CHECK_HEADERS([stdio.h],,[AC_MSG_FAILURE([stdio.h is not found.])])
AC_CHECK_HEADERS([stdlib.h],,[AC_MSG_FAILURE([stdlib.h is not found.])])
AC_CHECK_HEADERS([string.h],,[AC_MSG_FAILURE([string.h is not found.])])
AC_CHECK_HEADERS([time.h],,[AC_MSG_FAILURE([time.h is not found.])])
AC_CHECK_HEADERS([unistd.h],,[AC_MSG_FAILURE([unistd.h is not found.])])
AC_CHECK_HEADERS([libgen.h])
dnl ============ General =============
dnl ========== Backtrace =============
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <execinfo.h>
#include <sys/types.h>
]], [[void *array[10];
size_t size;
size = backtrace(array, 10);
backtrace_symbols_fd(array, size, 0);
]])],[ac_cv_var_backtrace=yes],[ac_cv_var_backtrace=no])
if test x$ac_cv_var_backtrace = xyes; then
AC_DEFINE(HAVE_BACKTRACE, 1, [System has usable backtrace implementation.])
else
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <ucontext.h>]], [[printstack(0);]])],[ac_cv_var_printstack=yes],[ac_cv_var_printstack=no])
if test x$ac_cv_var_printstack = xyes; then
AC_DEFINE(HAVE_PRINTSTACK, 1, [System has usable printstack implementation.])
fi
fi
dnl ========== Backtrace =============
dnl ============= X11 ================
no_x=""
AC_PATH_XTRA
if test "x$no_x" = "xyes"; then
echo "X11 libraries/headers could not be found."
echo "If they are definetly installed, use"
echo " --x-includes and --x-libraries to set the paths."
echo
echo "Aborting"
echo
exit 1
fi
dnl AC_SUBST(x_includes)
dnl AC_SUBST(x_libraries)
dnl ============= X11 ================
dnl ========= libxpm presence
ac_cv_xpm_supported=yes
AC_CHECK_LIB(Xpm,
XpmReadFileToPixmap, ,
[ac_cv_xpm_supported=no],
[$X_LIBS])
case "$ac_cv_xpm_supported" in
yes)
AC_DEFINE(XPM_SUPPORTED, 1, [enable XPM background support])
;;
*)
;;
esac
feature_list="XPM:$ac_cv_xpm_supported"
dnl ========= KDE icons support
AC_ARG_ENABLE(native-kde,
[ --disable-native-kde disable native kde tray icons support],
[ac_cv_no_native_kde="$enableval"],
[ac_cv_no_native_kde="yes"])
AC_ARG_ENABLE(debug,
[ --enable-debug enable debugging output\checks],
[ac_cv_debug="$enableval"],
[ac_cv_debug="yes"])
AC_ARG_ENABLE(events-trace,
[ --enable-events-trace enable full event trace (debug)],
[ac_cv_events_trace="$enableval"],
[ac_cv_events_trace="yes"])
AC_ARG_ENABLE(embedding-confirmation-delay,
[ --enable-embedding-confirmation-delay delay sending of embedding confirmation (debug)],
[AS_IF([test "x$enableval" != xno],
AC_DEFINE(DELAY_EMBEDDING_CONFIRMATION, 1, [delay sending of embedding confirmation])
LDFLAGS="$LDFLAGS -lpthread"
)],
[])
AC_ARG_ENABLE(dump-win-info,
[ --enable-dump-win-info use xprop/xwininfo to dump icon window info],
[ac_cv_dump_win_info="$enableval"],
[ac_cv_dump_win_info="yes"])
AC_ARG_ENABLE(graceful-exit,
[ --enable-graceful-exit use non-portable hack to exit gracefuly on signal],
[ac_cv_graceful_exit="$enableval"],
[ac_cv_graceful_exit="yes"])
case "$ac_cv_debug" in
yes)
AC_DEFINE(DEBUG, 1, [enable debugging code])
if test "x$GCC" = "xyes"; then
CFLAGS="$CFLAGS -g"
else
echo "INFO: Since you use non-gcc compiler, please enable generation of debug info"
echo " for your compiler manually (via CFLAGS shell variable)"
fi
;;
*)
;;
esac
feature_list="$feature_list DEBUG:$ac_cv_debug"
kde_tray_support="kde_tray.o"
case "$ac_cv_no_native_kde" in
no)
AC_DEFINE(NO_NATIVE_KDE, 1, [disable native kde tray icons support])
kde_tray_support=""
;;
*)
;;
esac
AC_SUBST(kde_tray_support)
case "$ac_cv_dump_win_info" in
yes)
AC_DEFINE(ENABLE_DUMP_WIN_INFO, 1, [use xprop/xwininfo to dump icon window info])
;;
*)
;;
esac
case "$ac_cv_graceful_exit" in
no)
;;
*)
AC_DEFINE(ENABLE_GRACEFUL_EXIT_HACK, 1, [use non-portable hack to exit gracefuly on signal])
;;
esac
case "$ac_cv_events_trace" in
yes)
AC_DEFINE(TRACE_EVENTS, 1, [enable full event trace (debug)])
;;
*)
;;
esac
feature_list="$feature_list KDE:$ac_cv_no_native_kde"
CPPFLAGS="$CPPFLAGS -DFEATURE_LIST='\"$feature_list\"'"
dnl ============ DocBook ============
dnl https://movementarian.org/docs/docbook-autotools/configure.html
AC_DEFUN([AX_CHECK_DOCBOOK], [
XSLTPROC_FLAGS=--nonet
DOCBOOK_ROOT=
for i in \
/usr/share/xml/docbook/stylesheet/docbook-xsl-nons \
/usr/share/xml/docbook/xsl-stylesheets-*-nons/ \
/usr/share/sgml/docbook/stylesheet/xsl/nwalsh \
/usr/share/xml/docbook/stylesheet/docbook-xs \
/usr/share/sgml/docbook/xsl-stylesheets/ \
/usr/share/xsl/docbook \
/usr/local/share/xsl/docbook \
; do
if test -d "$i"; then
DOCBOOK_ROOT=$i
fi
done
AC_SUBST(DOCBOOK_ROOT)
AC_CHECK_PROG(XSLTPROC,xsltproc,xsltproc,)
XSLTPROC_WORKS=no
if test -n "$XSLTPROC"; then
AC_MSG_CHECKING([whether xsltproc works])
DB_FILE="$DOCBOOK_ROOT/xhtml/docbook.xsl"
$XSLTPROC $XSLTPROC_FLAGS $DB_FILE >/dev/null 2>&1 << END
<?xml version="1.0" encoding='ISO-8859-1'?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd">
<book id="test">
</book>
END
if test "$?" = 0; then
XSLTPROC_WORKS=yes
fi
AC_MSG_RESULT($XSLTPROC_WORKS)
fi
AM_CONDITIONAL(have_xsltproc, test "$XSLTPROC_WORKS" = "yes")
AC_SUBST(XSLTPROC_FLAGS)
])
AX_CHECK_DOCBOOK
dnl ============ Features ============
AC_CONFIG_FILES([
Makefile
src/Makefile
])
AC_OUTPUT
echo "*"
echo "* Debug : $ac_cv_debug"
if test "x$ac_cv_debug" = "xyes" -a "x$GCC" != "xyes"; then
echo "* Since you are not using a gcc compatible compiler, please"
echo "* set debug CFLAGS manually (if you want to)"
fi
echo "* Native KDE support : $ac_cv_no_native_kde"
echo "* XPM background support : $ac_cv_xpm_supported"
echo "* Graceful exit support : $ac_cv_graceful_exit"
echo "* Build documentation : $XSLTPROC_WORKS"
echo "*"