Fix test script for listing service properties
[platform/upstream/connman.git] / acinclude.m4
1 AC_DEFUN([AC_PROG_CC_PIE], [
2         AC_CACHE_CHECK([whether ${CC-cc} accepts -fPIE], ac_cv_prog_cc_pie, [
3                 echo 'void f(){}' > conftest.c
4                 if test -z "`${CC-cc} -fPIE -pie -c conftest.c 2>&1`"; then
5                         ac_cv_prog_cc_pie=yes
6                 else
7                         ac_cv_prog_cc_pie=no
8                 fi
9                 rm -rf conftest*
10         ])
11 ])
12
13 AC_DEFUN([COMPILER_FLAGS], [
14         if (test "${CFLAGS}" = ""); then
15                 CFLAGS="-Wall -O2 -D_FORTIFY_SOURCE=2"
16         fi
17         if (test "$USE_MAINTAINER_MODE" = "yes"); then
18                 CFLAGS+=" -Werror -Wextra"
19                 CFLAGS+=" -Wno-unused-parameter"
20                 CFLAGS+=" -Wno-missing-field-initializers"
21                 CFLAGS+=" -Wdeclaration-after-statement"
22                 CFLAGS+=" -Wmissing-declarations"
23                 CFLAGS+=" -Wredundant-decls"
24                 CFLAGS+=" -Wcast-align"
25         fi
26 ])
27
28 AC_DEFUN([GTK_DOC_CHECK],
29 [
30   AC_BEFORE([AC_PROG_LIBTOOL],[$0])dnl setup libtool first
31   AC_BEFORE([AM_PROG_LIBTOOL],[$0])dnl setup libtool first
32   dnl for overriding the documentation installation directory
33   AC_ARG_WITH([html-dir],
34     AS_HELP_STRING([--with-html-dir=PATH], [path to installed docs]),,
35     [with_html_dir='${datadir}/gtk-doc/html'])
36   HTML_DIR="$with_html_dir"
37   AC_SUBST([HTML_DIR])
38
39   dnl enable/disable documentation building
40   AC_ARG_ENABLE([gtk-doc],
41     AS_HELP_STRING([--enable-gtk-doc],
42                    [use gtk-doc to build documentation [[default=no]]]),,
43     [enable_gtk_doc=no])
44
45   if test x$enable_gtk_doc = xyes; then
46     ifelse([$1],[],
47       [PKG_CHECK_EXISTS([gtk-doc],,
48                         AC_MSG_ERROR([gtk-doc not installed and --enable-gtk-doc requested]))],
49       [PKG_CHECK_EXISTS([gtk-doc >= $1],,
50                         AC_MSG_ERROR([You need to have gtk-doc >= $1 installed to build gtk-doc]))])
51   fi
52
53   AC_MSG_CHECKING([whether to build gtk-doc documentation])
54   AC_MSG_RESULT($enable_gtk_doc)
55
56   AC_PATH_PROGS(GTKDOC_CHECK,gtkdoc-check,)
57
58   AM_CONDITIONAL([ENABLE_GTK_DOC], [test x$enable_gtk_doc = xyes])
59   AM_CONDITIONAL([GTK_DOC_USE_LIBTOOL], [test -n "$LIBTOOL"])
60 ])