i3lock-color

The world's most popular non-default computer lockscreen.
Index Commits Files Refs README LICENSE
configure.ac (6638B)
   1 #                                               -*- Autoconf -*-
   2 # Run autoreconf -fi to generate a configure script from this file.
   3 
   4 AC_PREREQ([2.69])
   5 AC_INIT([i3lock-color],[m4_esyscmd_s([cat I3LOCK_VERSION])],[https://github.com/Raymo11/i3lock-color/issues])
   6 # For AX_EXTEND_SRCDIR
   7 AX_ENABLE_BUILDDIR
   8 AM_INIT_AUTOMAKE([foreign subdir-objects -Wall no-dist-gzip dist-bzip2])
   9 # Default to silent rules, use V=1 to get verbose compilation output.
  10 AM_SILENT_RULES([yes])
  11 # Make it possible to disable maintainer mode to disable re-generation of build
  12 # system files.
  13 AM_MAINTAINER_MODE([enable])
  14 AC_CONFIG_SRCDIR([i3lock.c])
  15 AC_CONFIG_HEADERS([config.h])
  16 AC_CONFIG_MACRO_DIR([m4])
  17 
  18 dnl Verify macros defined in m4/ such as AX_SANITIZERS are not present in the
  19 dnl output, i.e. are replaced as expected. This line results in a better error
  20 dnl message when using aclocal < 1.13 (which does not understand
  21 dnl AC_CONFIG_MACRO_DIR) without passing the -I m4 parameter.
  22 m4_pattern_forbid([AX_SANITIZERS])
  23 
  24 # Verify we are using GNU make because we use '%'-style pattern rules in
  25 # Makefile.am, which are a GNU make extension. Pull requests to replace
  26 # '%'-style pattern rules with a more portable alternative are welcome.
  27 AX_CHECK_GNU_MAKE
  28 AS_VAR_IF([_cv_gnu_make_command], [""], [AC_MSG_ERROR([the i3lock Makefile.am requires GNU make])])
  29 
  30 AX_EXTEND_SRCDIR
  31 
  32 AS_IF([test -d ${srcdir}/.git],
  33       [
  34         VERSION="$(git -C ${srcdir} describe --tags --abbrev=0)"
  35         I3LOCK_VERSION="$(git -C ${srcdir} describe --tags --always) ($(git -C ${srcdir} rev-list --pretty=format:%cd --date=short -n1 HEAD | tail -n1))"
  36         # Mirrors what libi3/is_debug_build.c does:
  37         is_release=$(test $(echo "${I3LOCK_VERSION}" | cut -d ' ' -f 1 | wc -m) -lt 13 && echo yes || echo no)
  38       ],
  39       [
  40         VERSION="$(cut -d '-' -f 1 ${srcdir}/I3LOCK_VERSION | cut -d ' ' -f 1)"
  41         I3LOCK_VERSION="$(sed -e 's/@<:@\"?\\@:>@/\\&/g' ${srcdir}/I3LOCK_VERSION)"
  42         is_release="$(grep -q non-git ${srcdir}/I3LOCK_VERSION && echo no || echo yes)"
  43       ])
  44 AC_SUBST([I3LOCK_VERSION], [$I3LOCK_VERSION])
  45 AC_DEFINE_UNQUOTED([I3LOCK_VERSION], ["${I3LOCK_VERSION}"], [i3lock version])
  46 
  47 AX_CODE_COVERAGE
  48 
  49 dnl is_release must be lowercase because AX_CHECK_ENABLE_DEBUG calls m4_tolower
  50 dnl on its fourth argument.
  51 AX_CHECK_ENABLE_DEBUG([no], , , [$is_release])
  52 
  53 AC_PROG_CC
  54 
  55 # For strnlen() and vasprintf().
  56 AC_USE_SYSTEM_EXTENSIONS
  57 
  58 # Checks for typedefs, structures, and compiler characteristics.
  59 AC_CHECK_HEADER_STDBOOL
  60 dnl The error message should include the specific type which could not be
  61 dnl found, but I do not see a way to achieve that.
  62 AC_CHECK_TYPES([mode_t, off_t, pid_t, size_t, ssize_t], , [AC_MSG_FAILURE([cannot find required type])])
  63 
  64 # Checks for library functions.
  65 AC_FUNC_FORK
  66 AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK
  67 AC_FUNC_STRNLEN
  68 AC_CHECK_FUNCS([atexit dup2 ftruncate getcwd gettimeofday localtime_r memchr memset mkdir rmdir setlocale socket strcasecmp strchr strdup strerror strncasecmp strndup strrchr strspn strstr strtol strtoul], , [AC_MSG_FAILURE([cannot find the $ac_func function, which i3lock requires])])
  69 AC_CHECK_FUNCS([explicit_bzero])
  70 
  71 # Check for libraries
  72 AC_SEARCH_LIBS([floor], [m], , [AC_MSG_FAILURE([cannot find the required floor() function despite trying to link with -lm])])
  73 
  74 # libev does not ship with a pkg-config file :(.
  75 AC_SEARCH_LIBS([ev_run], [ev], , [AC_MSG_FAILURE([cannot find the required ev_run() function despite trying to link with -lev])])
  76 
  77 AC_SEARCH_LIBS([shm_open], [rt])
  78 
  79 # Use system-local-login instead of login on Arch and Gentoo
  80 if [[ -f /etc/arch-release ]] || [[ -f /etc/gentoo-release ]]; then
  81     echo "Using PAM for Arch/Gentoo"
  82     sed -i "s/^#auth include system-local-login/auth include system-local-login/g" ../pam/i3lock
  83     sed -i "s/^auth include login/#auth include login/g" ../pam/i3lock
  84 fi
  85 
  86 # Only disable PAM on OpenBSD where i3lock uses BSD Auth instead
  87 case "$host" in
  88     *-openbsd*)
  89     # Nothing yet.
  90     ;;
  91     *)
  92     AC_SEARCH_LIBS([pam_authenticate], [pam])
  93     ;;
  94 esac
  95 
  96 AC_SEARCH_LIBS([iconv_open], [iconv], , [AC_MSG_FAILURE([cannot find the required iconv_open() function despite trying to link with -liconv])])
  97 
  98 dnl Each prefix corresponds to a source tarball which users might have
  99 dnl downloaded in a newer version and would like to overwrite.
 100 PKG_CHECK_MODULES([XCB], [xcb xcb-xkb xcb-xinerama xcb-randr xcb-composite])
 101 PKG_CHECK_MODULES([XCB_IMAGE], [xcb-image])
 102 PKG_CHECK_MODULES([XCB_UTIL], [xcb-event xcb-util xcb-atom])
 103 PKG_CHECK_MODULES([XCB_UTIL_XRM], [xcb-xrm])
 104 PKG_CHECK_MODULES([XKBCOMMON], [xkbcommon xkbcommon-x11])
 105 PKG_CHECK_MODULES([CAIRO], [cairo])
 106 PKG_CHECK_MODULES([JPEG], [libjpeg])
 107 PKG_CHECK_MODULES([FONTCONFIG], [fontconfig])
 108 
 109 
 110 # Checks for programs.
 111 AC_PROG_AWK
 112 AC_PROG_CPP
 113 AC_PROG_INSTALL
 114 AC_PROG_MAKE_SET
 115 AC_PROG_RANLIB
 116 AC_PROG_LN_S
 117 
 118 AM_PROG_AR
 119 
 120 AX_FLAGS_WARN_ALL
 121 AX_APPEND_FLAG([-O2], [AM_CFLAGS])
 122 AX_APPEND_FLAG([-funroll-loops], [AM_CFLAGS])
 123 AX_APPEND_FLAG([-pthread], [AM_CFLAGS])
 124 AX_CHECK_COMPILE_FLAG([-Wunused-value], [AX_APPEND_FLAG([-Wunused-value], [AM_CFLAGS])])
 125 AC_SUBST(AM_CFLAGS)
 126 
 127 AX_CHECK_BASH_COMPLETION
 128 AX_CHECK_ZSH_COMPLETION
 129 
 130 # Checks for header files.
 131 AC_CHECK_HEADERS([fcntl.h float.h inttypes.h limits.h locale.h netinet/in.h paths.h stddef.h stdint.h stdlib.h string.h sys/param.h sys/socket.h sys/time.h unistd.h], , [AC_MSG_FAILURE([cannot find the $ac_header header, which i3lock requires])])
 132 
 133 AC_CONFIG_FILES([Makefile])
 134 
 135 # Enable address sanitizer for debug builds. The performance hit is a
 136 # 50% increase of wallclock time for the testsuite on my machine.
 137 if test "x$ax_enable_debug" = "xyes"; then
 138     default_sanitizers=address
 139 else
 140     default_sanitizers=
 141 fi
 142 AX_SANITIZERS(, [$default_sanitizers])
 143 
 144 AC_OUTPUT
 145 
 146 in_git_worktree=`git rev-parse --is-inside-work-tree 2>/dev/null`
 147 if [[ "$in_git_worktree" = "true" ]]; then
 148     git_dir=`git rev-parse --git-dir 2>/dev/null`
 149     srcdir=`dirname "$git_dir"`
 150     exclude_dir=`pwd | sed "s,^$srcdir,,g"`
 151     if ! grep -q "^$exclude_dir" "$git_dir/info/exclude"; then
 152         echo "$exclude_dir" >> "$git_dir/info/exclude"
 153     fi
 154 fi
 155 
 156 echo \
 157 "--------------------------------------------------------------------------------
 158 build configured:
 159 
 160 AS_HELP_STRING([i3lock version:], [`echo ${I3LOCK_VERSION} | sed 's,\\\\,,g'`])
 161 AS_HELP_STRING([is release version:], [${is_release}])
 162 
 163 AS_HELP_STRING([enable debug flags:], [${ax_enable_debug}])
 164 AS_HELP_STRING([code coverage:], [${CODE_COVERAGE_ENABLED}])
 165 AS_HELP_STRING([enabled sanitizers:], [${ax_enabled_sanitizers}])"
 166 
 167 #To compile, run:
 168 #
 169 #  cd `pwd` && make
 170 echo \
 171 "--------------------------------------------------------------------------------"