summaryrefslogtreecommitdiffstats
path: root/configure.ac
blob: cce8589dab0bd125806daa6c060e7554183db9c0 (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
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
dnl Process this file with autoconf to produce a configure script.

# get rid of that stupid cache mechanism
rm -f config.cache

PROJECT_VERSION([0], [0], [1], [dev])
AC_INIT([eina_graph], [v_ver], [jeremy@asynk.ch])
AC_PREREQ([2.65])
AC_CONFIG_SRCDIR([configure.ac])
AC_CONFIG_MACRO_DIR([m4])

AC_CONFIG_HEADERS([config.h])
AH_TOP([
#ifndef __CONFIG_H__
#define __CONFIG_H__
])
AH_BOTTOM([
#endif /* __CONFIG_H__ */
])

AM_INIT_AUTOMAKE([1.10 dist-bzip2])
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])

# this will speed up libtool checks
LT_PREREQ([2.2])
LT_INIT([win32-dll])
PROJECT_INIT

### Default options with respect to host

AC_CANONICAL_BUILD
AC_CANONICAL_HOST

### Additional options to configure

# Build profile

AC_ARG_WITH([profile],
   [AC_HELP_STRING([--with-profile=PROFILE],
                   [use the predefined build profile, one of: dev, debug and release.
                    @<:@default=dev@:>@])],
   [build_profile=${withval}],
   [build_profile=def_build_profile])

case "${build_profile}" in
   dev|debug|release)
     ;;
   *)
     AC_MSG_ERROR([Unknown build profile --with-profile=${build_profile}])
     ;;
esac

# Tests

AC_ARG_WITH([tests],
   [AC_HELP_STRING([--with-tests=none|regular|coverage],
                   [choose testing method: regular, coverage or none.
                    @<:@default=none@:>@])],
   [build_tests=${withval}],
   [build_tests=auto])

want_coverage="no"
want_tests="no"
case "${build_tests}" in
   auto)
     if test "${build_profile}" = "dev"; then
        want_tests="yes"
     fi
     ;;
   regular)
     want_tests="yes"
     ;;
   coverage)
     want_tests="yes"
     want_coverage="yes"
     ;;
   none)
     ;;
   *)
     AC_MSG_ERROR([Unknown build tests option: --with-tests=${build_tests}])
     ;;
esac

### Checks for programs

AC_PROG_CC

# pkg-config

PKG_PROG_PKG_CONFIG

# Check whether pkg-config supports Requires.private

if $PKG_CONFIG --atleast-pkgconfig-version 0.22; then
   pkgconfig_requires_private="Requires.private"
else
   pkgconfig_requires_private="Requires"
fi
AC_SUBST(pkgconfig_requires_private)

# lcov

if test "${want_coverage}" = "yes" ; then
   AC_CHECK_PROG([have_lcov], [lcov], [yes], [no])
   if test "x${have_lcov}" = "xyes" ; then
      EINA_GRAPH_COV_CFLAGS="${EINA_GRAPH_COV_CFLAGS} -fprofile-arcs -ftest-coverage"
      EINA_GRAPH_COV_LIBS="${EINA_GRAPH_COV_LIBS} -lgcov"
      if test "x${prefer_assert}" = "xno"; then
         EINA_GRAPH_COV_CFLAGS="${EINA_GRAPH_COV_CFLAGS} -DNDEBUG"
      else
         EINA_GRAPH_COV_CFLAGS="${EINA_GRAPH_COV_CFLAGS} -g -O0 -DDEBUG"
      fi
   else
      AC_MSG_ERROR([lcov is not found])
   fi
fi

AC_SUBST(EINA_GRAPH_COV_LIBS)
AC_SUBST(EINA_GRAPH_COV_CFLAGS)
AM_CONDITIONAL([EINA_GRAPH_ENABLE_COVERAGE], [test "${want_coverage}" = "yes"])

### Checks for libraries

# check unit testing library

if test "${want_tests}" = "yes"; then
   PKG_CHECK_MODULES([CHECK], [check >= 0.9.5])
fi
AM_CONDITIONAL([EINA_GRAPH_ENABLE_TESTS], [test "${want_tests}" = "yes"])

# Checks for library functions.

# Evil library for compilation on Windows

EINA_GRAPH_BUILD=""
case "$host_os" in
   mingw*)
      PKG_CHECK_MODULES([EVIL], [evil >= 1.0.0])
      AC_DEFINE([HAVE_EVIL], [1], [Set to 1 if Evil library is installed])
      requirement_eina_graph="evil ${requirement_eina_graph}"
      EINA_GRAPH_BUILD="-DEINA_GRAPH_BUILD"
      ;;
esac
AC_SUBST(EINA_GRAPH_BUILD)

# Dependencies for the library

requirement_eina_graph="eina >= 1.8.0 ${requirement_eina_graph}"
PKG_CHECK_MODULES([EFL], [ $requirement_eina_graph ])

AC_SUBST(requirement_eina_graph)

# Checks for library functions.

AM_GNU_GETTEXT_VERSION([0.18])

### Checks for header files

EFL_CHECK_PATH_MAX

### Checks for types

### Checks for structures

### Checks for compiler characteristics

AM_PROG_CC_C_O
AC_C_CONST
AC_PROG_CC_STDC
AC_HEADER_STDC

ELM_QUICKLAUNCH
EFL_ATTRIBUTE_VECTOR

case "$host_os" in
   mingw32ce*)
      EINA_GRAPH_CFLAGS="${EINA_GRAPH_CFLAGS} -D_WIN32_WCE=0x0420"
      ;;
esac

EFL_CHECK_COMPILER_FLAGS([EINA_GRAPH], [-Wall -Wunused -Wextra -Wpointer-arith -Wno-missing-field-initializers -fvisibility=hidden -fdata-sections -ffunction-sections])
EFL_CHECK_LINKER_FLAGS([EINA_GRAPH], [-fvisibility=hidden -fdata-sections -ffunction-sections -Wl,--gc-sections -fno-strict-aliasing -Wl,--as-needed -Wl,--no-copy-dt-needed-entries])

case "${build_profile}" in
   dev)
     dnl Check if compiler has a dodgy -Wshadow that emits errors when shadowing a global
     AC_MSG_CHECKING([whether -Wshadow generates spurious warnings])
     CFLAGS_save="${CFLAGS}"
     CFLAGS="${CFLAGS} -Werror -Wshadow"
     AC_TRY_COMPILE([int x;], [int x = 0; (void)x;],
       [AC_MSG_RESULT([no])
        EFL_CHECK_COMPILER_FLAGS([EFL], [-Wshadow])],
       [AC_MSG_RESULT([yes])])
     CFLAGS="${CFLAGS_save}"
     ;;

   debug)
     ;;

   release)
     ;;
esac

# CPU architecture specific assembly

### Checks for linker characteristics

lt_enable_auto_import=""
case "$host_os" in
   mingw*)
      lt_enable_auto_import="-Wl,--enable-auto-import"
      ;;
esac
AC_SUBST(lt_enable_auto_import)

### Output

AC_OUTPUT([
   eina_graph.pc
   Makefile
   src/Makefile
])

AC_OUTPUT

#####################################################################
## Info

echo
echo
echo
echo "------------------------------------------------------------------------"
echo "$PACKAGE $VERSION"
echo "------------------------------------------------------------------------"
echo
echo "Compilation................: make (or gmake)"
echo "  CPPFLAGS.................: $CPPFLAGS"
echo "  CFLAGS...................: $CFLAGS"
echo "  LDFLAGS..................: $LDFLAGS"
echo
echo "Installation...............: make install (as root if needed, with 'su' or 'sudo')"
echo "  prefix...................: $prefix"
echo "  edje_cc..................: ${edje_cc}"
echo
echo "Configuration...: ${COLOR_OTHER}profile=${build_profile} os=${host_os}${COLOR_RESET}"
echo
if test "${want_coverage}" = "yes"; then
echo "Tests...........: make lcov-check"
else
if test "${want_tests}" = "yes"; then
echo "Tests...........: make check"
else
echo "Tests...........: no"
fi
fi
echo