aboutsummaryrefslogtreecommitdiffstats
path: root/configure.ac
blob: f55064cd2aeed6ec12f7efcf571466d4110dee6f (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
AC_INIT([libsamsung-ipc], [0.7.0], [replicant@osuosl.org], [libsamsung-ipc])
AC_CONFIG_SRCDIR([Makefile.am])
AC_CONFIG_HEADERS(config.h)
AM_INIT_AUTOMAKE([dist-bzip2 dist-xz subdir-objects])
XZ_OPT=-v9e
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])

OPENSSL_REQUIRED=1.0.0e

#------------------------------------------------------------------------------
# pkg-config

PKG_PROG_PKG_CONFIG

#------------------------------------------------------------------------------
# openssl

PKG_CHECK_MODULES(OPENSSL, openssl >= $OPENSSL_REQUIRED)
AC_SUBST(OPENSSL_CFLAGS)
AC_SUBST(OPENSSL_LIBS)
AC_SUBST(VALGRIND)

#------------------------------------------------------------------------------
# check for debugging
AC_ARG_ENABLE(debug,
  [  --enable-debug          Enable debug build (default=disabled)],
  [debug=$enableval],
  [debug="no"])
AM_CONDITIONAL( [WANT_DEBUG], [test x"$debug" = x"yes"])

#------------------------------------------------------------------------------
# TODO: GCC has --enable-checking= for extensive runtime checks and one of the
#       available values is valgrind, so it would be a good idea to convert to
#       it for consistency across free software projects.
AC_ARG_ENABLE(valgrind-tests,
  [  --enable-valgrind-tests  Build with -ggdb3, -O0 and use valgrind from PATH during tests (default=disabled)],
  [valgrind_tests=$enableval],
  [valgrind_tests="no"])

AM_CONDITIONAL( [WANT_VALGRIND_CHECKING], [test x"$valgrind_tests" = x"yes"])

AS_IF([test x"$valgrind_tests" = x"yes"],
  [AC_CHECK_PROG([VALGRIND], [valgrind], [valgrind])
   AS_IF(
     [test x"$VALGRIND" = x""],
     [AC_MSG_ERROR(
       [valgrind tests are enabled but valgrind was not found in PATH ($PATH)])])])
#------------------------------------------------------------------------------
AC_CONFIG_FILES([
    Makefile
    samsung-ipc.pc
    include/Makefile
    samsung-ipc/Makefile
    samsung-ipc/tests/Makefile
    tools/Makefile
])


#------------------------------------------------------------------------------
AS_IF([test x"$valgrind_tests" = x"yes"], [: ${CFLAGS="-ggdb3 -O0"}],
      [test x"debug" = x"yes"], [: ${CFLAGS="-ggdb -O0"}], [])

AC_PROG_CC
AM_PROG_CC_C_O
AC_GNU_SOURCE
AC_DISABLE_STATIC
AC_PROG_LIBTOOL

AC_SUBST(CFLAGS)
AC_SUBST(CPPFLAGS)
AC_SUBST(LDFLAGS)

AC_OUTPUT
#------------------------------------------------------------------------------
# info

echo "------------------------------------------------------------------------"
echo "$PACKAGE_NAME $PACKAGE_VERSION"
echo "------------------------------------------------------------------------"
echo
echo "Configuration Options:"
echo
echo "  debug build.............: $debug"
echo
echo "  prefix..................: $prefix"
echo
echo "  valgrind tests..........: $valgrind_tests"
echo
echo "------------------------------------------------------------------------"
echo
echo "Now type 'make' to compile and 'make install' to install this package."