]> ruderich.org/simon Gitweb - wall-notify/wall-notify.git/blobdiff - configure.ac
fix -m option
[wall-notify/wall-notify.git] / configure.ac
index f5634a6f0903ee1fe3bf15d88b2d616d74f97415..f7380b89c355d9945f93ece952b55d0603a5c83d 100644 (file)
@@ -25,7 +25,6 @@ AC_CONFIG_SRCDIR([src/wall-notify.c])
 dnl Get functions which are only provided by e.g. _XOPEN_SOURCE.
 AC_USE_SYSTEM_EXTENSIONS
 
-AM_PROG_AR
 AM_INIT_AUTOMAKE([foreign -Wall -Werror])
 
 AC_PROG_CC
@@ -38,12 +37,16 @@ fi
 AC_CHECK_HEADERS([utempter.h utmpx.h])
 
 if test "x$ac_cv_header_utempter_h" = xyes; then
+    AC_CHECK_FUNCS([setresuid setresgid],[],
+                   [AC_MSG_ERROR([setresuid() and setresgid() required for utmpx])])
+
     AC_MSG_NOTICE([using utempter])
     AC_CHECK_LIB([utempter], [utempter_add_record],
                  [], [AC_MSG_ERROR([utempter_add_record() required])])
     AC_CHECK_LIB([utempter], [utempter_remove_record],
                  [], [AC_MSG_ERROR([utempter_remove_record() required])])
     AC_DEFINE([USE_UTEMPTER], 1, [Define to 1 to use utempter.])
+
 elif test "x$ac_cv_header_utmpx_h" = xyes; then
     AC_MSG_NOTICE([using utmp])
     AC_DEFINE([USE_UTMPX], 1, [Define to 1 to use utmp.])
@@ -55,7 +58,29 @@ AC_TYPE_PID_T
 AC_TYPE_SIZE_T
 AC_TYPE_SSIZE_T
 
-AC_CONFIG_FILES([Makefile src/Makefile])
+disable_x11_support=
+AC_ARG_ENABLE([x11],
+              [AS_HELP_STRING([--disable-x11], [disable x11 support])],
+              [if test "x$enableval" = xno; then
+                   disable_x11_support=yes
+                   AC_DEFINE([DONT_USE_X11], 1, [Define to not use X11.])
+               fi])
+
+if test -z "$disable_x11_support"; then
+    AX_PTHREAD([],[AC_MSG_ERROR([pthread is required, use --disable-x11])])
+    LIBS="$PTHREAD_LIBS $LIBS"
+    CFLAGS="$PTHREAD_CFLAGS $CFLAGS"
+    CC="$PTHREAD_CC"
+
+    AC_PATH_XTRA
+    if test x"$no_x" = xyes; then
+        AC_MSG_ERROR([X11 is required, use --disable-x11])
+    fi
+    LIBS="$X_PRE_LIBS $X_EXTRA_LIBS $X_LIBS -lX11 $LIBS"
+    CFLAGS="$X_CFLAGS $CFLAGS"
+fi
+
+AC_CONFIG_FILES([Makefile src/Makefile man/Makefile])
 AC_OUTPUT
 
 if test "x$ac_cv_header_utempter_h" != xyes; then