summaryrefslogtreecommitdiff
path: root/configure.ac
blob: a73f0df8c95c2caef50ed13a52ebd1558038ee63 (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
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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
#                                               -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.


# create tag version information
m4_define([pers_client_library_tag_version_major], [1])
m4_define([pers_client_library_tag_version_minor], [1])
m4_define([pers_client_library_tag_version_micro], [0])
m4_define([pers_client_library_tag_version], [pers_client_library_tag_version_major().pers_client_library_tag_version_minor().pers_client_library_tag_version_micro()])


AC_INIT([Persistence Client Library], [pers_client_library_tag_version], [genivi-persistence@lists.genivi.org])
AC_COPYRIGHT([Copyright (c) 2014 XS Embedded GmbH])
AC_CONFIG_SRCDIR([Makefile.am])
AM_INIT_AUTOMAKE([dist-bzip2])
AC_GNU_SOURCE()


# create library version information
m4_define([pers_client_library_version_current],  [8])
m4_define([pers_client_library_version_revision], [1])
m4_define([pers_client_library_version_age],      [1])
m4_define([pers_client_library_version], [pers_client_library_version_current():pers_client_library_version_revision():pers_client_library_version_age()])

PERS_CLIENT_LIBRARY_VERSION=pers_client_library_version()
AC_SUBST([PERS_CLIENT_LIBRARY_VERSION])


m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])


# Overwrite the build in defaults
CFLAGS="-Wall -O -Werror -fstack-protector -pthread -Wformat -Wformat-security -fexceptions -fstrict-aliasing -fno-omit-frame-pointer -Wconversion -D_FORTIFY_SOURCE=2 -Wno-format-truncation"

# Checks for programs.
AC_PROG_CC
AM_PROG_CC_C_O
AC_PROG_LIBTOOL
PKG_PROG_PKG_CONFIG

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


# Checks for header files.
AC_CHECK_HEADERS([fcntl.h limits.h stdlib.h string.h unistd.h])

# Checks for typedefs, structures, and compiler characteristics.
AC_TYPE_UID_T
AC_TYPE_MODE_T
AC_TYPE_OFF_T
AC_TYPE_SIZE_T
AC_TYPE_UINT32_T
AC_TYPE_UINT64_T

AC_ARG_ENABLE([tests],
              [AS_HELP_STRING([--enable-tests],[Enable tests])],
              [enable_tests=$enableval],[enable_tests="no"])

AM_CONDITIONAL([WANT_TESTS], [test x"$enable_tests" = "xyes"])


AC_ARG_ENABLE([tools],
              [AS_HELP_STRING([--enable-tools],[Enable tools])],
              [enable_tools=$enableval],[enable_tools="no"])

AM_CONDITIONAL([WANT_TOOLS], [test x"$enable_tools" = "xyes"])


 
# Checks for library functions.
AC_FUNC_CHOWN
AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK
AC_FUNC_MMAP
AC_CHECK_FUNCS([fdatasync ftruncate mkdir munmap rmdir strerror utime dlopen])

PKG_CHECK_MODULES(DEPS,
                  automotive-dlt
                  libperscommon
                  dbus-1)

AC_SUBST(DEPS_CFLAGS)
AC_SUBST(DEPS_LIBS)

AC_ARG_WITH([localcheck],
              [AS_HELP_STRING([--with-localcheck],[Path to local check])],
              [localcheck=$withval],[localcheck=""])

if test "x$enable_tests" != "xno" ; then
   if test -z "$localcheck" ; then
      PKG_CHECK_MODULES([CHECK], [check >= 0.9.6])
   else
      CHECK_CFLAGS="-I$localcheck/include"
      CHECK_LIBS="-L$localcheck/lib -lcheck"
   fi
   AC_SUBST(CHECK_CFLAGS)
   AC_SUBST(CHECK_LIBS)

   AC_DEFINE_UNQUOTED([TESTS_ENABLED], [1], [tests enabled])
else
   AC_DEFINE_UNQUOTED([TESTS_ENABLED], [0], [tests disabled])
fi
AC_MSG_NOTICE([Tests enabled: $enable_tests])
AC_MSG_NOTICE([Local check enabled: $localcheck])


# enable persistence administration service dbus interface ###########
AC_ARG_ENABLE([pasinterface],
            [AS_HELP_STRING([--enable-pasinterface],[Enable pas interface])],
            [use_pasinterface=$enableval],
            [use_pasinterface="no"])

AM_CONDITIONAL([USE_PASINTERFACE], [test x"$use_pasinterface" = "no"])

if test "$use_pasinterface" != "yes" -a "$use_pasinterface" != "no"; then
   AC_MSG_ERROR([Invalid pas interface check mode specified: $use_pasinterface. Only "yes" or "no" is valid])
else   
   AC_MSG_NOTICE([Use pas interface check is: $use_pasinterface])

   if test "$use_pasinterface" = "yes"; then
      AC_DEFINE_UNQUOTED([USE_PASINTERFACE], [1], [pasinterface enabled])   
   fi
fi
######################################################################


# enable persistence file cache component ###########
AC_ARG_ENABLE([filecache],
            [AS_HELP_STRING([--enable-filecache],[Enable file cache component])],
            [use_filecache=$enableval],
            [use_filecache="no"])

AM_CONDITIONAL([USE_FILECACHE], [test x"$use_filecache" = "no"])

if test "$use_filecache" != "yes" -a "$use_filecache" != "no"; then   
   AC_MSG_ERROR([Invalid file cache check mode specified: $use_filecache. Only "yes" or "no" is valid])
else   
   AC_MSG_NOTICE([Use file cache: $use_filecache])

   if test "$use_filecache" = "yes"; then
      PKG_CHECK_MODULES(PFC, persistence_file_cache)
      AC_DEFINE_UNQUOTED([USE_FILECACHE], [1], [filecache enabled])   
   fi
fi
   AC_SUBST(PFC_CFLAGS)
   AC_SUBST(PFC_LIBS)
######################################################################


# enable persistence application security check ###########
AC_ARG_ENABLE([appcheck],
            [AS_HELP_STRING([--enable-appcheck],[Enable application security check])],
            [use_appcheck=$enableval],
            [use_appcheck="no"])

AM_CONDITIONAL([USE_APPCHECK], [test x"$use_appcheck" = "no"])

if test "$use_appcheck" != "yes" -a "$use_appcheck" != "no"; then   
   AC_MSG_ERROR([Invalid application security check: $use_appcheck. Only "yes" or "no" is valid])
else   
   AC_MSG_NOTICE([Use application security check: $use_appcheck])

   if test "$use_appcheck" = "yes"; then
      AC_DEFINE_UNQUOTED([USE_APPCHECK], [1], [application check enabled])   
   fi
fi
######################################################################


AC_ARG_ENABLE(debug,
AS_HELP_STRING([--enable-debug],
               [enable debugging, default: no]),
[case "${enableval}" in
             yes) debug=true ;;
             no)  debug=false ;;
             *)   AC_MSG_ERROR([bad value ${enableval} for --enable-debug]) ;;
esac],
[debug=false])

AM_CONDITIONAL(DEBUG, test x"$debug" = x"true")
######################################################################

# enable to use fsync instead of fdatasync for write through #########
AC_ARG_ENABLE([fsync],
            [AS_HELP_STRING([--enable-fsync],[Enable fsync instead of fdatasync])],
            [use_fsync=$enableval],
            [use_fsync="no"])

AM_CONDITIONAL([USE_FSYNC], [test x"$use_fsync" = "no"])

if test "$use_fsync" != "yes" -a "$use_fsync" != "no"; then   
   AC_MSG_ERROR([Invalid fsync check check: $use_fsync. Only "yes" or "no" is valid])
else   
   AC_MSG_NOTICE([Use fsync: $use_fsync])

   if test "$use_fsync" = "yes"; then
      AC_DEFINE_UNQUOTED([USE_FSYNC], [1], [fsync is anabled])   
   fi
fi
######################################################################


AC_CONFIG_FILES([Makefile
                 persistence_client_library.pc
                 config/pclCustomLibConfigFile.cfg
                 config/pclCustomLibConfigFileTest.cfg
                 config/pclCustomLibConfigFileEmpty.cfg
                 config/pclCustomLibConfigFileWrongDefault.cfg
                 src/Makefile
                 tools/Makefile
                 test/Makefile])
              
AC_OUTPUT