]> ruderich.org/simon Gitweb - wall-notify/wall-notify.git/blob - configure.ac
remove superfluous braces in comment
[wall-notify/wall-notify.git] / configure.ac
1 dnl Copyright (C) 2014-2015  Simon Ruderich
2 dnl
3 dnl This program is free software: you can redistribute it and/or modify
4 dnl it under the terms of the GNU General Public License as published by
5 dnl the Free Software Foundation, either version 3 of the License, or
6 dnl (at your option) any later version.
7 dnl
8 dnl This program is distributed in the hope that it will be useful,
9 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
10 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11 dnl GNU General Public License for more details.
12 dnl
13 dnl You should have received a copy of the GNU General Public License
14 dnl along with this program.  If not, see <http://www.gnu.org/licenses/>.
15
16
17 AC_PREREQ([2.69])
18 AC_INIT([wall-notify],[0.1],[simon@ruderich.org])
19
20 AC_CONFIG_AUX_DIR([build-aux])
21 AC_CONFIG_MACRO_DIR([m4])
22 AC_CONFIG_HEADERS([config.h])
23 AC_CONFIG_SRCDIR([src/wall-notify.c])
24
25 dnl Get functions which are only provided by e.g. _XOPEN_SOURCE.
26 AC_USE_SYSTEM_EXTENSIONS
27
28 AM_INIT_AUTOMAKE([foreign -Wall -Werror])
29
30 AC_PROG_CC
31
32 if test "x$GCC" = xyes; then
33     CFLAGS="-Wall -Wextra -Wconversion $CFLAGS"
34 fi
35
36
37 AC_CHECK_HEADERS([utempter.h utmpx.h])
38
39 if test "x$ac_cv_header_utempter_h" = xyes; then
40     AC_MSG_NOTICE([using utempter])
41     AC_CHECK_LIB([utempter], [utempter_add_record],
42                  [], [AC_MSG_ERROR([utempter_add_record() required])])
43     AC_CHECK_LIB([utempter], [utempter_remove_record],
44                  [], [AC_MSG_ERROR([utempter_remove_record() required])])
45     AC_DEFINE([USE_UTEMPTER], 1, [Define to 1 to use utempter.])
46
47 elif test "x$ac_cv_header_utmpx_h" = xyes; then
48     AC_MSG_NOTICE([using utmp])
49     AC_CHECK_FUNCS([setresuid setresgid],[],
50                    [AC_MSG_ERROR([setresuid() and setresgid() required for utmpx])])
51     AC_DEFINE([USE_UTMPX], 1, [Define to 1 to use utmp.])
52
53 else
54     AC_MSG_ERROR([neither utmpx.h nor utempter.h found, aborting])
55 fi
56
57 AC_TYPE_PID_T
58 AC_TYPE_SIZE_T
59 AC_TYPE_SSIZE_T
60
61 disable_x11_support=
62 AC_ARG_ENABLE([x11],
63               [AS_HELP_STRING([--disable-x11], [disable x11 support])],
64               [if test "x$enableval" = xno; then
65                    disable_x11_support=yes
66                    AC_DEFINE([DONT_USE_X11], 1, [Define to not use X11.])
67                fi])
68
69 if test -z "$disable_x11_support"; then
70     AX_PTHREAD([],
71                [AC_MSG_ERROR([pthread is required for X, use --disable-x11])])
72     LIBS="$PTHREAD_LIBS $LIBS"
73     CFLAGS="$PTHREAD_CFLAGS $CFLAGS"
74     CC="$PTHREAD_CC"
75
76     AC_PATH_XTRA
77     if test x"$no_x" = xyes; then
78         AC_MSG_ERROR([X11 is required, use --disable-x11])
79     fi
80     LIBS="$X_PRE_LIBS $X_EXTRA_LIBS $X_LIBS -lX11 $LIBS"
81     CFLAGS="$X_CFLAGS $CFLAGS"
82 fi
83
84 AC_CONFIG_FILES([Makefile src/Makefile man/Makefile])
85 AC_OUTPUT
86
87 if test "x$ac_cv_header_utempter_h" != xyes; then
88     AC_MSG_NOTICE([utempter not found, you must make wall-notify setgid utmp])
89 fi