1 dnl Initialize autoconf and automake
3 AC_CONFIG_SRCDIR(src/main.c)
5 AM_INIT_AUTOMAKE(adesklets,0.4.10)
10 dnl Locate required external software
12 if test "x$CPP" != 'x'; then
18 if test "x$LEX" != 'xflex'; then
20 -----------------------------------------------------
21 `flex' was not found on your system. If you encounter
22 problems recompiling a `l' file, please try `flex'
23 first. You can get it from any GNU archive site.
24 You will not need `flex' as long as you do not
26 ----------------------------------------------------])
29 if test "x$YACC" != "xbison -y"; then
31 -----------------------------------------------------
32 Nor `byacc' or `yacc' parsers had been used
33 for developing adesklets. If you encounter problems
34 recompiling a `y' file, please try `bison' instead.
35 You can get it from any GNU archive site. You will
36 not need `bison' as long as you do not modify
38 -----------------------------------------------------])
42 dnl Check for python support
44 AC_ARG_WITH(python-support,
45 [ --without-python-support
46 do not install adesklets python package
47 Do not set this option unless you have
50 if test x$withval = "xyes"; then
52 AC_ARG_WITH(python-force-detection,
53 [ --with-python-force-detection
54 bypass all the python version check mechanism.
55 When using this, make sure you have a version
56 greater or egal to python 2.3 installed
57 as 'python' in your path [default=no]])
59 if test x$withval = "xno"; then
66 AC_ARG_WITH(python-install-submission-scripts,
67 [ --with-python-install-submission-scripts
68 install in the path the submission-related scripts
69 from submit/ in the $PREFIX/bin program path.
70 Useful for desklets author [default=no]])
72 if test x$withval = "xyes"; then
73 AM_CONDITIONAL(PYTHON_INSTALL_SUBMISSION_SCRIPTS, true)
75 AM_CONDITIONAL(PYTHON_INSTALL_SUBMISSION_SCRIPTS, false)
77 AC_CHECK_FUNCS(sigprocmask,
78 [HAVE_SIGPROCMASK="#define HAVE_SIGPROCMASK 1", SIGPROC=yes],
79 [HAVE_SIGPROCMASK="#undef HAVE_SIGPROCMASK"])
81 HAVE_SIGPROCMASK="#undef HAVE_SIGPROCMASK"
83 AC_SUBST(HAVE_SIGPROCMASK)
84 AM_CONDITIONAL(PYTHON_SUPPORT, test "x$PYTHON" != "x")
85 AM_CONDITIONAL(PYTHON_INSTALL_SUBMISSION_SCRIPTS, true)
88 AC_PATH_PROG(HELP2MAN, help2man)
89 AM_CONDITIONAL(HELP2MAN_SUPPORT, test "x$HELP2MAN" != "x")
92 AC_PATH_PROG(TIDY,tidy)
95 AC_PATH_PROG(DOXYGEN,doxygen)
96 AM_CONDITIONAL(DOXYGEN_SUPPORT, test "x$DOXYGEN" != "x")
99 AM_CONDITIONAL(MAKEINFO_SUPPORT, test "x$MAKEINFO:" != "x")
102 dnl Try to enforce ISO C (iso9899 1999)
103 dnl This will more likely work
104 dnl only with gcc. In fact,
105 dnl expect for variadic macros, this program
106 dnl should be ansi C (ISO C90).
108 CFLAGS="$CFLAGS -std=c99 -pedantic -Wall"
109 AC_MSG_CHECKING([for ISO C99 warnings generation])
117 AC_MSG_RESULT([yes]),
122 dnl Define source to be BSD compliant (ISO C, POSIX, and 4.3BSD)
123 AC_DEFINE(_BSD_SOURCE,1,[Source is BSD compliant (ISO C, POSIX and 4.3BSD)])
124 if test "x`uname`" = xNetBSD; then
125 dnl NetBSD (at least version 1.6.1) is following the standard less closely than
126 dnl the other... Hence, we declare the source specifically as _POSIX_SOURCE
127 dnl instead of the newer _POSIX_C_SOURCE 199309
128 AC_DEFINE(_POSIX_SOURCE,1,[Source is POSIX 1 compliant (IEEE Std 1003.1)])
130 dnl For some unspecified reason, it as been reported than FreeBSD [5|6].x
131 dnl doesn't like those POSIX keywords either
132 UNAME_REDUX=`uname -r -s | sed 's/\..*//' 2> /dev/null`
133 if test "$UNAME_REDUX" != 'FreeBSD 5' && test "$UNAME_REDUX" != 'FreeBSD 6'
135 AC_DEFINE(_POSIX_C_SOURCE,199309,[Source is POSIX 4 compliant (IEEE Std 1003.1b)])
139 dnl Check for system header files
141 AC_CHECK_HEADERS(stdio.h stdarg.h errno.h fcntl.h signal.h time.h math.h sys/time.h sys/types.h sys/stat.h grp.h pwd.h libgen.h dirent.h iconv.h)
144 dnl This will filter out optimisation switch (-O[s0-9])
147 debug, [ --enable-debug enable debugging symbols and supplementary
148 messages generation in final binary])
151 AC_MSG_CHECKING([for debugging symbols generation])
152 if test x$enableval = "xyes"; then
154 AC_DEFINE(DEBUG, 1, [Debug mode is on if defined.])
159 CFLAGS=`echo "$CFLAGS" | sed 's/^-g$//; s/^-g@<:@@<:@:space:@:>@@:>@\+// ; s/@<:@@<:@:space:@:>@@:>@\+-g$//; s/@<:@@<:@:space:@:>@@:>@\+-g@<:@@<:@:space:@:>@@:>@\+/ /'`
162 dnl SIGKILL timeout setting
164 AC_MSG_CHECKING([for sigkill timeout])
165 AC_ARG_ENABLE(sigkill-timeout,
166 [ --enable-sigkill-timeout=SEC
167 timeout (in seconds) before sending `kill'
168 signal to parent process in case of restart
169 if `term' has no effect [default=5]])
171 test $enableval -gt 0 2> /dev/null || {
173 AC_MSG_ERROR([Given sigkill timeout was not understood])
176 AC_DEFINE_UNQUOTED(SIGKILL_TIMEOUT,$enableval,
177 [Delay between SIGTERM ans SIGKILL to parent process in case of restart.])
179 dnl X polling frequency setting
182 AC_MSG_CHECKING([for polling frequency])
183 AC_ARG_ENABLE(x-polling-frequency,
184 [ --enable-x-polling-frequency=FREQ
185 frequency (in hertz) for polling the X server
186 for events. Lower values leads to less responsive,
187 but less CPU hungry desklets [default=50]])
189 test $enableval -gt 0 2> /dev/null || {
191 AC_MSG_ERROR([Positive, integer value is required as x-polling-frequency])
194 AC_CHECK_PROG(EXISTS,bc,yes,no)
195 if test $enableval -ne 50; then
196 if test x$EXISTS = "xyes"; then
197 period=`echo "1000000 / $enableval" | bc`
199 AC_MSG_WARN([Could not find the `bc' calculator to perform arithmetic
200 computation of X server polling period value. Default 50 Hz is assumed.])
204 AC_DEFINE_UNQUOTED(X_POLLING_PERIOD,$period,
205 [Polling period (in 10e-6 seconds) of stdin between two cycles of events loop.])
207 dnl Lock files directory setting
209 AC_MSG_CHECKING([for lock files directory setting])
210 AC_ARG_ENABLE(lockfiles-dir,
211 [ --enable-lockfiles-dir=DIR
212 directory to put lock files in [default=/tmp]])
214 test -d $enableval || {
216 AC_MSG_ERROR([Given lock files directory does not exist on your system])
219 AC_DEFINE_UNQUOTED(LOCKFILES_DIR,"$enableval",
220 [Directory to put lock files in.])
222 dnl Control modifier on context menu
224 AC_MSG_CHECKING([for control modifier on context menu])
225 AC_ARG_ENABLE(control-on-context-menu,
226 [ --enable-control-on-context-menu
227 force CTRL to be pressed to fire context menu
230 if test x$enableval != "xno" ; then
232 AC_DEFINE(CONTROL_ON_CONTEXT_MENU,1,
233 [Force CTRL to be pressed to fire context menu])
238 dnl Collect various system informations strings,
239 dnl for embedding into final executable
241 WELCOME1="\"$PACKAGE $VERSION"
242 AC_CHECK_PROG(EXISTS,date,yes)
243 if test x$EXISTS = "xyes"; then
244 WELCOME1="$WELCOME1 ("`date | sed 's/@<:@@<:@:space:@:>@@:>@\+/ /g'`")"
246 WELCOME1="$WELCOME1 (unknown time)"
249 AC_CHECK_PROG(EXISTS,uname,yes)
250 if test x$EXISTS = "xyes"; then
251 if uname -rs &> /dev/null; then
252 WELCOME1="$WELCOME1, on "`uname -rs`"\""
254 WELCOME1="$WELCOME1, on an unknown OS\""
257 WELCOME1="$WELCOME1, on an unknown OS\""
259 AC_DEFINE_UNQUOTED(WELCOME_LINE_1, $WELCOME1, [Welcome message, first line.])
260 dnl Note: @<:@ and @:>@ are respective quadrigraphs for `[' and `]'
261 ${CC} --version &> /dev/null && \
262 WELCOME2="\"${CC} "`${CC} --version | sed -n '1 s/^@<:@^0-9@:>@*//p'`"\""
263 : ${WELCOME2:=\"${CC} unknown version\"}
264 AC_DEFINE_UNQUOTED(WELCOME_LINE_2, $WELCOME2, [Welcome message, second line.])
266 dnl Variables save: all changes to CFLAGS, LIBS and LDFLAGS beyond
267 dnl this point will be wiped
270 TMP_LDFLAGS="$LDFLAGS"
272 dnl Check for readline
273 AC_CHECK_LIB(ncurses, tputs, HaveLibTermcap=yes; LibTermcap=ncurses,
274 AC_CHECK_LIB(termcap, tputs, HaveLibTermcap=yes; LibTermcap=termcap,
275 AC_CHECK_LIB(curses, tputs, HaveLibTermcap=yes; LibTermcap=curses,
277 if test $HaveLibTermcap = "yes" ; then
278 LIBS="$LIBS -l$LibTermcap"
280 AC_MSG_ERROR([Could not find terminal management library for readline
281 (either ncurses, termcap or curses).])
283 AC_CHECK_LIB(readline,readline,
284 READLINE_LIBS="-l$LibTermcap -lreadline",
285 AC_MSG_ERROR([Could not find the readline library]),
289 dnl Check for libhistory support
292 [ --without-history remove history support in interactive use
295 if test x$withval = "xyes"; then
296 AC_CHECK_LIB(history,add_history,
297 READLINE_LIBS="$READLINE_LIBS -lhistory";
298 AC_DEFINE(HAVE_READLINE_HISTORY_H,1,
299 [Define to 1 if you have the <readline/history.h> header file.])
301 AC_CHECK_LIB(history,free_history_entry,
302 AC_DEFINE(HAVE_FREE_HISTORY_ENTRY,1,
303 [Define to 1 if you have the `free_history_entry' function.])),
306 if test $HaveLibHistory = "no"; then
307 AC_MSG_WARN([Could not find GNU history library in the system])
309 AC_MSG_CHECKING([for history max command lenght])
311 AC_ARG_ENABLE(history-max-command-lenght,
312 [ --enable-history-max-command-lenght=LEN
313 maximum string lenght (in characters) that a single
314 command can have and still be kept in history
315 (a lenght of zero meaning no limits) [default=256]])
318 if test $enableval -ge 0 ; then
320 AC_DEFINE_UNQUOTED(HISTORY_MAX_COMMAND_LENGHT,$enableval,
321 [maximum history string lenght.])
324 AC_MSG_ERROR([history max command lenght must be positive or null])
328 AC_SUBST(READLINE_LIBS)
330 dnl Check for 8 bit characters support forcing
332 AC_ARG_ENABLE(force-extended-characters-input,
333 [ --enable-force-extended-characters-input
334 force input and ouput of unescaped
335 height bits characters through GNU readline,
336 regardless of the inputrc settings [default=no]])
338 if ! test x$enableval = "xno" ; then
339 AC_DEFINE(FORCE_EXTENDED_CHARACTERS_INPUT,1,
340 [force 8 bit characters support in GNU readline])
343 dnl Check for fontconfig
345 AC_ARG_WITH(fontconfig,
346 [ --without-fontconfig remove fontconfig support enabling automatic
347 detection of all truetype fonts already available
350 if test x$withval = "xyes"; then
351 AC_PATH_PROG(PKG_CONFIG, pkg-config)
352 if ! test x$PKG_CONFIG = "x" ; then
353 if $PKG_CONFIG --exists fontconfig 2> /dev/null; then
354 FONTCONFIG_LIBS=`pkg-config --libs fontconfig`
355 FONTCONFIG_CFLAGS=`pkg-config --cflags fontconfig`
358 if test x$FONTCONFIG_LIBS = "x"; then
359 FONTCONFIG_LIBS=-lfontconfig
361 LIBS="$LIBS $FONTCONFIG_LIBS"
362 CFLAGS="$CFLAGS $FONTCONFIG_CFLAGS"
363 AC_MSG_CHECKING([for fontconfig])
365 #include <fontconfig/fontconfig.h>
368 AC_DEFINE(HAVE_FONTCONFIG_FONTCONFIG_H,1,[Define to 1 if you have the <fontconfig/fontconfig.h> header file.]),
373 -----------------------------------------------------
374 `fontconfig' was not found on your system.
375 Although `adesklets' will work anyway system-wide
376 automatic font detection will not occur:
377 it is therefore quite possible that only the
378 default font provided with the package will display.
379 -----------------------------------------------------]))
380 AC_SUBST(FONTCONFIG_LIBS)
381 AC_SUBST(FONTCONFIG_CFLAGS)
386 dnl Check for fork() system call
387 AC_CHECK_FUNCS(fork,,
388 AC_MSG_ERROR([Could not find the fork() system call]))
390 dnl Check for X headers and libraries
394 if test x$no_x != "xyes"; then
396 test x$x_includes = "x" && x_includes="/usr/include"
397 test x$x_libraries = "x" && x_libraries="/usr/lib"
399 X_LIBS="$X_LIBS $X_EXTRA_LIBS"
401 CFLAGS="$CFLAGS $X_CFLAGS"
402 LDFLAGS="$LDFLAGS $LIBS $X_PRE_LIBS"
403 dnl Check for required functions in -lX11
404 AC_CHECK_LIB(X11, XOpenDisplay,
405 X_LIBS="$X_LIBS -lX11"
407 AC_MSG_ERROR([Could not find XOpenDisplay in -lX11.])
409 AC_DEFINE(X_DISPLAY_SUPPORT,1,[Define to 1 if the X Window System is supported, 0 otherwise.])
411 AC_DEFINE(X_DISPLAY_SUPPORT,0,[Define to 1 if the X Window System is supported, 0 otherwise.])
423 [ --with-imlib2=DIR use imlib2 in <DIR>],
424 [CFLAGS="$CFLAGS -I$withval/include"
425 LIBS="-L$withval/lib $LIBS"])
427 AC_PATH_GENERIC_MODIFIED(imlib2, 1.1.2,
428 [ AC_SUBST(IMLIB2_LIBS)
429 AC_SUBST(IMLIB2_CFLAGS) ],
430 AC_MSG_ERROR([Cannot find imlib2: Is imlib2-config in the path?]),
433 -----------------------------------------------------
434 $PACKAGE should work with your version of imlib2...
435 But for better results you are _warmly_ encouraged
436 to try out version 1.2.0 or above;
437 known bugs are still lurking in dark corners
438 with what you have installed: beware strange problems
439 with dynamic image filters for instance!
440 -----------------------------------------------------]))
441 LIBS="$LIBS $IMLIB2_LIBS"
442 CFLAGS="$CFLAGS $IMLIB2_CFLAGS"
444 AC_MSG_CHECKING([for imlib2 program linking])
446 #ifndef X_DISPLAY_MISSING
447 #include <X11/Xlib.h>
448 #include <X11/Xutil.h>
450 #include <X11/Xatom.h>
454 image = imlib_load_image("toto.png");
455 #ifndef X_DISPLAY_MISSING
456 imlib_context_set_display(NULL);
459 AC_MSG_RESULT([yes]),
461 AC_MSG_ERROR([Cannot link Imlib2 program.
462 If you specified you did not want X support this can be caused
463 by your Imlib2 installment being configured so it needs it
464 or conversely. In that case reinstall Imlib2 with proper
465 --enable-x11-support parameter (as from enlightement CVS)
466 before retrying to configure this package.]))
468 dnl Test for uint typedef
469 AC_MSG_CHECKING([for uint typedef in standard library])
471 #ifdef HAVE_SYS_TYPES_H
472 #include <sys/types.h>
478 AC_MSG_RESULT([yes]),
480 AC_DEFINE(UINT_NOT_DEFINED,1,
481 [Define to 1 if compability type uint is not detected.])
484 dnl Important variables reset
487 LDFLAGS="$TMP_LDFLAGS"
489 dnl PKGDATADIR definition
490 dnl PKGDATADIR is only well constructed in make context,
491 dnl so let's put this AFTER all tests.
492 CFLAGS="$CFLAGS"' -DPKGDATADIR=\"$(pkgdatadir)\"'
495 AM_CONFIG_HEADER(src/config.h)
504 scripting/protoize.sh
505 scripting/python/Makefile
506 scripting/python/config.h
507 scripting/python/setup.py
510 dnl Change script(s) permissions
511 chmod +x scripting/protoize.sh doc/htmldoc.sh
513 dnl Final warning, if needed
514 if test x$DEBUG = "xyes"; then
516 -----------------------------------------------------
517 you choosed to make a `debug' compilation: this will
518 generate a significantly bigger executable
519 that produces on stderr (by default) a lot of outputs
520 unwanted during normal use; set up the ADESKLETS_LOG
521 environment variable to a filename the interpreter
522 can safely suffix with a pid related extension
523 than truncate to collect all debug outputs
524 there instead. Be also aware that all optimisation
525 settings (-O flags in CFLAGS) are discarded when
527 -----------------------------------------------------])
529 if test x$no_x = "xyes"; then
531 -----------------------------------------------------
532 you choosed to perform an `X Window less' build -
533 which means you will eventually end up with
534 a strictly command line program free of all
535 dependencies on xlib. If it is not what you intended
536 please reconfigure. For this to work you do need first
537 to configure your Imlib2 incantation for not using
539 -----------------------------------------------------
543 if test x$PYTHON != "x" ; then
544 if test x$SIGPROC != "xyes" ; then
546 -----------------------------------------------------
547 your system does not seem to support reliable POSIX
548 signal calls such as `sigprocmask', `sigpending' or
549 `sigsuspend'. Although this does not affect $PACKAGE
550 directly, it seriously impedes python ability
551 to handle things well through its package.
552 To our knowledge, no modern UNIX platforms lack
553 those system calls...
554 -----------------------------------------------------