ofono: Add support for CDMA modems
[framework/connectivity/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                 CFLAGS="$CFLAGS -DG_DISABLE_DEPRECATED"
26         fi
27 ])
28
29 AC_DEFUN([GTK_DOC_CHECK],
30 [
31   AC_BEFORE([AC_PROG_LIBTOOL],[$0])dnl setup libtool first
32   AC_BEFORE([AM_PROG_LIBTOOL],[$0])dnl setup libtool first
33   dnl for overriding the documentation installation directory
34   AC_ARG_WITH([html-dir],
35     AS_HELP_STRING([--with-html-dir=PATH], [path to installed docs]),,
36     [with_html_dir='${datadir}/gtk-doc/html'])
37   HTML_DIR="$with_html_dir"
38   AC_SUBST([HTML_DIR])
39
40   dnl enable/disable documentation building
41   AC_ARG_ENABLE([gtk-doc],
42     AS_HELP_STRING([--enable-gtk-doc],
43                    [use gtk-doc to build documentation [[default=no]]]),,
44     [enable_gtk_doc=no])
45
46   if test x$enable_gtk_doc = xyes; then
47     ifelse([$1],[],
48       [PKG_CHECK_EXISTS([gtk-doc],,
49                         AC_MSG_ERROR([gtk-doc not installed and --enable-gtk-doc requested]))],
50       [PKG_CHECK_EXISTS([gtk-doc >= $1],,
51                         AC_MSG_ERROR([You need to have gtk-doc >= $1 installed to build gtk-doc]))])
52   fi
53
54   AC_MSG_CHECKING([whether to build gtk-doc documentation])
55   AC_MSG_RESULT($enable_gtk_doc)
56
57   AC_PATH_PROGS(GTKDOC_CHECK,gtkdoc-check,)
58
59   AM_CONDITIONAL([ENABLE_GTK_DOC], [test x$enable_gtk_doc = xyes])
60   AM_CONDITIONAL([GTK_DOC_USE_LIBTOOL], [test -n "$LIBTOOL"])
61 ])