summaryrefslogtreecommitdiffstats
path: root/configure.ac
blob: 5437638ee44de904d0e351b332aa365f3567f885 (plain)
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
dnl Process this file with autoconf to produce a configure script.

AC_INIT([gslapt], [0.5.6], [woodwardj@jaos.org])
AC_CONFIG_SRCDIR([configure.ac])
AM_INIT_AUTOMAKE([-Wall foreign])
AM_CONFIG_HEADER(config.h)
AC_CONFIG_SRCDIR([src/])
IT_PROG_INTLTOOL([0.35.0])

AC_CANONICAL_HOST

AC_ISC_POSIX
AC_PROG_CC_C99

case "$host_cpu" in
i[[3456]]86) host_cpu=i386 ;CFLAGS="$CFLAGS -fpic";;
x86_64) host_cpu=x86_64 ;CFLAGS="$CFLAGS -fPIC";;
arm*) host_cpu=arm ;;
esac

AC_HEADER_STDC
AC_C_CONST
AC_C_VOLATILE
AC_FUNC_REALLOC
AC_TYPE_SIZE_T
AC_TYPE_SSIZE_T
AC_PROG_INSTALL
AC_CHECK_FUNCS([strchr])
AC_CHECK_FUNCS([strdup])
AC_CHECK_FUNCS([strndup])
AC_CHECK_FUNCS([strpbrk])
AC_CHECK_FUNCS([strstr])
AC_CHECK_HEADERS([libintl.h])
AC_CHECK_HEADER(curl/curl.h, [], [AC_MSG_ERROR(libcurl headers are missing)])
AC_CHECK_HEADER(slapt.h, [], [AC_MSG_ERROR(libslapt headers are missing)])
AC_CHECK_LIB(z,gzopen, [LIBS="$LIBS -lz"], [AC_MSG_ERROR(libz is missing)])
AC_CHECK_LIB(m,round, [LIBS="$LIBS -lm"], [AC_MSG_ERROR(libm is missing)])
AC_CHECK_LIB(curl,curl_global_init, [LIBS="$LIBS `curl-config --libs`"], [AC_MSG_ERROR(curl libs are missing)])
AC_SEARCH_LIBS([EVP_md5],[ssl crypto],[],[AC_MSG_ERROR(openssl libs are missing)])
AC_CHECK_LIB(gpgme,gpgme_new, [
    LIBS="`gpgme-config --libs` $LIBS"
    AC_CHECK_LIB(slapt,slapt_add_pkg_source_gpg_key,
      [AC_DEFINE(SLAPT_HAS_GPGME, 1, [libslapt has builtin gpgme support])],
      [AC_MSG_WARN(libslapt does not have gpgme support)])
], [AC_MSG_WARN(gpg support disabled)])
AC_CHECK_LIB(slapt,slapt_vector_t_init, [], [AC_MSG_ERROR(libslapt 0.11.1 or greater is required)])


glib_modules="glib-2.0 gthread-2.0 gmodule-2.0 gmodule-export-2.0"
PKG_CHECK_MODULES(GLIB, [$glib_modules])
AC_SUBST(GLIB_CFLAGS)
AC_SUBST(GLIB_LIBS)
gtk2_modules="gtk+-2.0 >= 2.24.0"
gtk3_modules="gtk+-3.0 >= 3.4.0"
AM_CONDITIONAL(GTK3, true)
AM_CONDITIONAL(GTK2, false)
AC_ARG_ENABLE(gtk3,
   [  --enable-gtk3                   Build with GTK3 support],
   [enable_gtk3=$enableval], [enable_gtk3=yes])
AC_ARG_ENABLE(gtk2,
   [  --enable-gtk2                   Build with GTK2 support],
   [enable_gtk2=$enableval], [enable_gtk2=no])
if test x"$enable_gtk2" = x"yes"; then
  PKG_CHECK_MODULES(GTK, [$gtk2_modules])
  AM_CONDITIONAL(GTK3, false)
  AM_CONDITIONAL(GTK2, true)
else
  PKG_CHECK_MODULES(GTK, [$gtk3_modules])
  AM_CONDITIONAL(GTK3, true)
  AM_CONDITIONAL(GTK2, false)
fi
AC_SUBST(GTK_CFLAGS)
AC_SUBST(GTK_LIBS)

AS_AC_EXPAND(DATADIR, $datadir)
POLKIT_SYSTEM_ACTIONS_DIR="$DATADIR/polkit-1/actions"
AC_SUBST(POLKIT_SYSTEM_ACTIONS_DIR)
AC_DEFINE_UNQUOTED(POLKIT_SYSTEM_ACTIONS_DIR, "$POLKIT_SYSTEM_ACTIONS_DIR", [Where system actions dir for POLKIT is])
AM_CONDITIONAL(POLKIT, false)

AC_ARG_WITH(
  [polkit],
  AC_HELP_STRING([--with-polkit], [use Polkit pkexec to start gslapt (default is auto)]),
  [ac_cv_prog_PKEXEC=$withval],
  [AC_CHECK_PROG([PKEXEC], [pkexec], yes, [no])]
)
if test x"$ac_cv_prog_PKEXEC" = x"yes"; then
  AM_CONDITIONAL(POLKIT, true)
fi

GETTEXT_PACKAGE=gslapt
AC_SUBST(GETTEXT_PACKAGE)
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Gettext package.])
AM_GLIB_GNU_GETTEXT

AC_CONFIG_FILES([
Makefile
src/Makefile
po/Makefile.in
ui/Makefile
])
AC_OUTPUT