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

3
AC_PREREQ(2.59c)
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)

160 161
if test "x$GCC" = "xyes"; then
  LDFLAGS="-Wl,--as-needed $LDFLAGS"
162 163
fi

David Zeuthen's avatar
David Zeuthen committed
164
AC_OUTPUT([
165
libpolkit.pc
David Zeuthen's avatar
David Zeuthen committed
166 167 168 169 170
Makefile
libpolkit/Makefile
tools/Makefile
doc/Makefile
doc/api/Makefile
171 172
doc/api/libpolkit/Makefile
doc/api/libpolkit/version.xml
David Zeuthen's avatar
David Zeuthen committed
173
doc/spec/Makefile
174 175
doc/spec/polkit-spec.xml.in
doc/man/Makefile
176
privileges/Makefile
177 178 179 180
modules/Makefile
modules/default/Makefile
modules/allow-all/Makefile
modules/deny-all/Makefile
David Zeuthen's avatar
David Zeuthen committed
181 182 183 184
])

dnl ==========================================================================
echo "
Kay Sievers's avatar
Kay Sievers committed
185
                  PolicyKit $VERSION
186
                =================
David Zeuthen's avatar
David Zeuthen committed
187 188

        prefix:                     ${prefix}
189 190 191 192 193 194 195 196
        libdir:                     ${libdir}
        libexecdir:                 ${libexecdir}
        bindir:                     ${bindir}
        sbindir:                    ${sbindir}
        datadir:                    ${datadir}
        sysconfdir:                 ${sysconfdir}
        localstatedir:              ${localstatedir}
        docdir:                     ${docdir}
David Zeuthen's avatar
David Zeuthen committed
197 198 199 200

        compiler:                   ${CC}
        cflags:                     ${CFLAGS}
        cppflags:                   ${CPPFLAGS}
201 202
        xmlto:                      ${XMLTO}
        xmllint:                    ${XMLLINT}
David Zeuthen's avatar
David Zeuthen committed
203 204 205 206

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