configure.in 5.77 KB
Newer Older
David Zeuthen's avatar
David Zeuthen committed
1 2 3
dnl Process this file with autoconf to produce a configure script.

AC_PREREQ(2.57)
4 5
AC_INIT(PolicyKit, 0.3, david@fubar.dk)
AM_INIT_AUTOMAKE(PolicyKit, 0.3)
David Zeuthen's avatar
David Zeuthen committed
6 7 8 9 10 11 12
AM_CONFIG_HEADER(config.h)
AM_MAINTAINER_MODE

# libtool versioning - this applies to libpolkit
#
# See http://sources.redhat.com/autobook/autobook/autobook_91.html#SEC91 for details
#
13
LT_CURRENT=1
David Zeuthen's avatar
David Zeuthen committed
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
LT_REVISION=0
LT_AGE=0
AC_SUBST(LT_CURRENT)
AC_SUBST(LT_REVISION)
AC_SUBST(LT_AGE)

AC_ISC_POSIX
AC_PROG_CC
AM_PROG_CC_STDC
AC_HEADER_STDC
AM_PROG_LIBTOOL
AC_PROG_MAKE_SET
AC_PROG_LN_S
AC_SYS_LARGEFILE

# Taken from dbus
AC_ARG_ENABLE(ansi,             [  --enable-ansi           enable -ansi -pedantic gcc flags],enable_ansi=$enableval,enable_ansi=no)
AC_ARG_ENABLE(verbose-mode,     [  --enable-verbose-mode   support verbose debug mode],enable_verbose_mode=$enableval,enable_verbose_mode=$USE_MAINTAINER_MODE)
32 33 34
AC_ARG_ENABLE(docbook-docs,     [  --enable-docbook-docs   build documentation (requires xmlto)],enable_docbook_docs=$enableval,enable_docbook_docs=no)
AC_ARG_ENABLE(man-pages,        [  --enable-man-pages      build manual pages],enable_man_pages=$enableval,enable_man_pages=yes)
AM_CONDITIONAL(MAN_PAGES_ENABLED, test x$enable_man_pages = xyes)
David Zeuthen's avatar
David Zeuthen committed
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 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123

GTK_DOC_CHECK([1.3])

#### gcc warning flags

if test "x$GCC" = "xyes"; then
  changequote(,)dnl
  case " $CFLAGS " in
  *[\ \	]-Wall[\ \	]*) ;;
  *) CFLAGS="$CFLAGS -Wall" ;;
  esac

  case " $CFLAGS " in
  *[\ \	]-Wchar-subscripts[\ \	]*) ;;
  *) CFLAGS="$CFLAGS -Wchar-subscripts" ;;
  esac

  case " $CFLAGS " in
  *[\ \	]-Wmissing-declarations[\ \	]*) ;;
  *) CFLAGS="$CFLAGS -Wmissing-declarations" ;;
  esac

  case " $CFLAGS " in
  *[\ \	]-Wnested-externs[\ \	]*) ;;
  *) CFLAGS="$CFLAGS -Wnested-externs" ;;
  esac

  case " $CFLAGS " in
  *[\ \	]-Wpointer-arith[\ \	]*) ;;
  *) CFLAGS="$CFLAGS -Wpointer-arith" ;;
  esac

  case " $CFLAGS " in
  *[\ \	]-Wcast-align[\ \	]*) ;;
  *) CFLAGS="$CFLAGS -Wcast-align" ;;
  esac

  case " $CFLAGS " in
  *[\ \	]-Wsign-compare[\ \	]*) ;;
  *) CFLAGS="$CFLAGS -Wsign-compare" ;;
  esac

  if test "x$enable_ansi" = "xyes"; then
    case " $CFLAGS " in
    *[\ \	]-ansi[\ \	]*) ;;
    *) CFLAGS="$CFLAGS -ansi" ;;
    esac

    case " $CFLAGS " in
    *[\ \	]-D_POSIX_C_SOURCE*) ;;
    *) CFLAGS="$CFLAGS -D_POSIX_C_SOURCE=199309L" ;;
    esac

    case " $CFLAGS " in
    *[\ \	]-D_BSD_SOURCE[\ \	]*) ;;
    *) CFLAGS="$CFLAGS -D_BSD_SOURCE" ;;
    esac

    case " $CFLAGS " in
    *[\ \	]-pedantic[\ \	]*) ;;
    *) CFLAGS="$CFLAGS -pedantic" ;;
    esac
  fi
  if test x$enable_gcov = xyes; then
    case " $CFLAGS " in
    *[\ \	]-fprofile-arcs[\ \	]*) ;;
    *) CFLAGS="$CFLAGS -fprofile-arcs" ;;
    esac
    case " $CFLAGS " in
    *[\ \	]-ftest-coverage[\ \	]*) ;;
    *) CFLAGS="$CFLAGS -ftest-coverage" ;;
    esac

    ## remove optimization
    CFLAGS=`echo "$CFLAGS" | sed -e 's/-O[0-9]*//g'`
  fi
  changequote([,])dnl
else
  if test x$enable_gcov = xyes; then
    AC_MSG_ERROR([--enable-gcov can only be used with gcc])
  fi
fi

AM_CONDITIONAL(GCOV, test x$enable_gcov = xyes)

PKG_CHECK_MODULES(GLIB, [glib-2.0 >= 2.6.0])
AC_SUBST(GLIB_CFLAGS)
AC_SUBST(GLIB_LIBS)

124 125 126 127
PKG_CHECK_MODULES(DBUS, [dbus-1 >= 1.0])
AC_SUBST(DBUS_CFLAGS)
AC_SUBST(DBUS_LIBS)

David Zeuthen's avatar
David Zeuthen committed
128 129
AC_CHECK_FUNCS(getgrouplist)

David Zeuthen's avatar
David Zeuthen committed
130 131 132 133
# DocBook Documentation

AC_MSG_CHECKING([whether to build DocBook documentation])

134 135 136 137 138
AC_PATH_PROG(XMLTO, xmlto, no)
AC_PATH_PROG(XMLLINT, xmllint, no)

if test x$XMLLINT = xno ; then
    have_xmllint=no
David Zeuthen's avatar
David Zeuthen committed
139
else
140
    have_xmllint=yes
David Zeuthen's avatar
David Zeuthen committed
141 142 143
fi

if test x$enable_docbook_docs = xauto ; then
144
    if test x$have_xmlto = xno || test x$have_xmllint = xno ; then
David Zeuthen's avatar
David Zeuthen committed
145 146 147 148 149 150 151
        enable_docbook_docs=no
    else
        enable_docbook_docs=yes
    fi
fi

if test x$enable_docbook_docs = xyes; then
152 153
    if test x$have_xmlto = xno; then
	AC_MSG_ERROR([Building DocBook docs explicitly required, but xmlto not found])
David Zeuthen's avatar
David Zeuthen committed
154 155 156 157 158 159
    fi
fi

AM_CONDITIONAL(DOCBOOK_DOCS_ENABLED, test x$enable_docbook_docs = xyes)
AC_MSG_RESULT(yes)

David Zeuthen's avatar
David Zeuthen committed
160 161 162 163 164 165 166 167 168
AS_AC_EXPAND(LOCALSTATEDIR, $localstatedir)
AS_AC_EXPAND(SYSCONFDIR, $sysconfdir)
AS_AC_EXPAND(DATADIR, $datadir)
AS_AC_EXPAND(BINDIR, $bindir)
AS_AC_EXPAND(SBINDIR, $sbindir)
AS_AC_EXPAND(LIBDIR, $libdir)
AS_AC_EXPAND(LIBEXECDIR, $libexecdir)

# documentation target
169
AC_ARG_WITH(doc-dir,   [  --with-doc-dir=[dirname]     directory to install documentation])
David Zeuthen's avatar
David Zeuthen committed
170 171 172 173 174 175 176 177
if ! test -z "$with_doc_dir"; then
   DOCDIR=$with_doc_dir
else
   DOCDIR="$DATADIR/doc/PolicyKit-$VERSION"
fi

AC_SUBST(DOCDIR)

178 179
if test "x$GCC" = "xyes"; then
  LDFLAGS="-Wl,--as-needed $LDFLAGS"
180 181
fi

David Zeuthen's avatar
David Zeuthen committed
182
AC_OUTPUT([
183
libpolkit.pc
David Zeuthen's avatar
David Zeuthen committed
184 185 186 187 188
Makefile
libpolkit/Makefile
tools/Makefile
doc/Makefile
doc/api/Makefile
189 190
doc/api/libpolkit/Makefile
doc/api/libpolkit/version.xml
David Zeuthen's avatar
David Zeuthen committed
191
doc/spec/Makefile
192 193
doc/spec/polkit-spec.xml.in
doc/man/Makefile
194 195
doc/man/polkit-check-caller.1
doc/man/polkit-check-session.1
David Zeuthen's avatar
David Zeuthen committed
196 197 198 199
])

dnl ==========================================================================
echo "
Kay Sievers's avatar
Kay Sievers committed
200
                  PolicyKit $VERSION
201
                =================
David Zeuthen's avatar
David Zeuthen committed
202 203 204 205 206 207 208 209 210 211 212 213 214 215

        prefix:                     ${prefix}
        libdir:                     ${LIBDIR}
        libexecdir:                 ${LIBEXECDIR}
        bindir:                     ${BINDIR}
        sbindir:                    ${SBINDIR}
        datadir:                    ${DATADIR}
        sysconfdir:                 ${SYSCONFDIR}
        localstatedir:              ${LOCALSTATEDIR}
        docdir:                     ${DOCDIR}

        compiler:                   ${CC}
        cflags:                     ${CFLAGS}
        cppflags:                   ${CPPFLAGS}
216 217
        xmlto:                      ${XMLTO}
        xmllint:                    ${XMLLINT}
David Zeuthen's avatar
David Zeuthen committed
218 219 220 221

        Maintainer mode:            ${USE_MAINTAINER_MODE}
        Building verbose mode:      ${enable_verbose_mode}
        Building api docs:          ${enable_gtk_doc}
David Zeuthen's avatar
David Zeuthen committed
222
        Building docs:              ${enable_docbook_docs}
223
        Building man pages:         ${enable_man_pages}
David Zeuthen's avatar
David Zeuthen committed
224
"