summaryrefslogtreecommitdiff
path: root/configure.ac
blob: 4f37f286c4f2801cdeb8bd3518088055e846bc7b (plain) (blame)
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
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
m4_define([v_maj], [1])
m4_define([v_min], [0])
m4_define([v_mic], [3])
m4_define([v_rev], m4_esyscmd([(git rev-list --count HEAD 2>/dev/null || echo 0) | tr -d '\n']))dnl
##--   When released, remove the dnl on the below line
m4_undefine([v_rev])
##--   When doing snapshots - change soname. remove dnl on below line
m4_define([relname], [ver-pre-svn-09])
m4_define([v_rel], [-release relname])
##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
m4_ifdef([v_rev], [m4_define([v_ver], [v_maj.v_min.v_mic.v_rev])],
[m4_define([v_ver], [v_maj.v_min.v_mic])])
m4_define([lt_rev], m4_eval(v_maj + v_min))
m4_define([lt_cur], v_mic)
m4_define([lt_age], v_min)
##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##

AC_INIT([maelstrom], [v_ver], [michael.blumenkrantz@gmail.com], [maelstrom])
AC_CONFIG_SRCDIR([Makefile.am])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_HEADER([config.h])

AC_USE_SYSTEM_EXTENSIONS

##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
m4_ifdef([v_rev], , [m4_define([v_rev], [0])])
m4_ifdef([v_rel], , [m4_define([v_rel], [])])
AC_DEFINE_UNQUOTED(VMAJ, [v_maj], [Major version])
AC_DEFINE_UNQUOTED(VMIN, [v_min], [Minor version])
AC_DEFINE_UNQUOTED(VMIC, [v_mic], [Micro version])
AC_DEFINE_UNQUOTED(VREV, [v_rev], [Revison])
version_info="lt_rev:lt_cur:lt_age"
release_info="v_rel"
AC_SUBST(version_info)
AC_SUBST(release_info)
##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
VMAJ=v_maj
AC_SUBST(VMAJ)

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

LT_INIT([win32-dll disable-static])
AC_PROG_YACC
AC_PROG_CXX
AC_PROG_INSTALL
AC_PROG_CC
AC_PROG_CC_FOR_BUILD
AM_PROG_CC_C_O
AC_PROG_MAKE_SET

AC_HEADER_STDBOOL
AC_C_INLINE
AC_TYPE_SIZE_T

AC_CHECK_SIZEOF([char])
AC_CHECK_SIZEOF([short])
AC_CHECK_SIZEOF([int])
AC_CHECK_SIZEOF([long])

AC_FUNC_ALLOCA
AC_FUNC_MALLOC
AC_FUNC_REALLOC
AC_FUNC_STRTOD
AC_CHECK_FUNCS([strdup strndup memrchr])

PKG_PROG_PKG_CONFIG

min_efl_version=1.7
MAELSTROM_REQUIRES=

#############################

AC_ARG_ENABLE([email],
   [AC_HELP_STRING([--disable-email], [disable building email @<:@default=yes@:>@])],
   [want_email=$enableval],
   [want_email="yes"]
)

EMAIL_REQUIRES="ecore-con >= $min_efl_version ecore >= $min_efl_version eina >= $min_efl_version"
build_email="no"

if test "x$want_email" = "xyes" ; then
   PKG_CHECK_EXISTS([$EMAIL_REQUIRES], [build_email="yes"], [build_email="no"])
fi

if test "x$build_email" = "xyes" ; then
   PKG_CHECK_MODULES([EMAIL], [$EMAIL_REQUIRES])
   MAELSTROM_REQUIRES="$EMAIL_REQUIRES"
fi

AM_CONDITIONAL([BUILD_EMAIL], [test "x${build_email}" = "xyes"])

#################################

AC_ARG_ENABLE([shotgun],
   [AC_HELP_STRING([--disable-shotgun], [disable building shotgun @<:@default=yes@:>@])],
   [want_shotgun=$enableval],
   [want_shotgun="yes"]
)

SHOTGUN_REQUIRES="ecore-con >= $min_efl_version ecore >= $min_efl_version eina >= $min_efl_version"
build_shotgun="no"

if test "x$want_shotgun" = "xyes" ; then
   PKG_CHECK_EXISTS([$SHOTGUN_REQUIRES], [build_shotgun="yes"], [build_shotgun="no"])
fi

if test "x$build_shotgun" = "xyes" ; then
   PKG_CHECK_MODULES([SHOTGUN], [$SHOTGUN_REQUIRES])
   MAELSTROM_REQUIRES="$SHOTGUN_REQUIRES"
fi

AM_CONDITIONAL([BUILD_SHOTGUN], [test "x${build_shotgun}" = "xyes"])

#############################

AC_ARG_ENABLE([azy],
   [AC_HELP_STRING([--disable-azy], [disable building azy @<:@default=detect@:>@])],
   [want_azy=$enableval],
   [want_azy="auto"]
)

AZY_REQUIRES="ecore-con >= $min_efl_version ecore >= $min_efl_version eina >= $min_efl_version eet >= $min_efl_version"

case "$host_os" in
   mingw*)
      AZY_REQUIRES="${AZY_REQUIRES} evil >= $min_efl_version"
      AC_DEFINE([HAVE_EVIL], [1], [Set to 1 if Evil package is installed])
   ;;
esac

build_azy="no"

if test "x$want_azy" = "xyes" || test "x$want_azy" = "xauto" ; then
   if test -z "$YACC" ; then
      if test "x$want_azy" = "xyes" ; then
         AC_MSG_ERROR([yacc not found])
      else
         AC_MSG_WARN([yacc not found, azy disabled])
      fi
   else
      PKG_CHECK_EXISTS([$AZY_REQUIRES], [build_azy="yes"], [build_azy="no"])
   fi
fi

if test "x$build_azy" = "xyes" ; then
   PKG_CHECK_MODULES([AZY], [$AZY_REQUIRES])
fi

AM_CONDITIONAL([BUILD_AZY], [test "x${build_azy}" = "xyes"])

AC_ARG_ENABLE([mysql-tests],
   [AC_HELP_STRING([--disable-mysql-tests], [disable code for mysql in tests @<:@default=yes@:>@])],
   [want_mysql=$enableval],
   [want_mysql="yes"]
)

if test "x$want_mysql" = "xyes" && test "x$build_azy" = "xyes" ; then
   AC_PATH_PROG([mysql_config], [mysql_config])
   if test "x$mysql_config" != "x" ; then
      AC_CHECK_HEADERS([mysql.h mysql/mysql.h], [have_mysql="yes"], [have_mysql="no"])
      if test "x$have_mysql" = "xyes" ; then
         MYSQL_CFLAGS="$($mysql_config --cflags)"
         MYSQL_LIBS="$($mysql_config --libs_r)"
         AC_DEFINE_UNQUOTED([HAVE_MYSQL], [1], ["enable some mysql code in tests"])
      fi
   fi
fi

AC_MSG_CHECKING([whether mysql tests are compiled])
AC_MSG_RESULT([$have_mysql])

AM_CONDITIONAL([HAVE_MYSQL], [test "x$have_mysql" = "xyes"])

AC_SUBST([MYSQL_CFLAGS])
AC_SUBST([MYSQL_LIBS])

AC_PATH_PROG([RE2C], [re2c])

have_re2c="yes"
if test -z $ac_cv_path_RE2C ; then
   AC_MSG_ERROR([You need to install re2c to build azy files])
fi

#################################

AC_ARG_ENABLE([shotgun-gui],
   [AC_HELP_STRING([--disable-shotgun-gui], [disable building shotgun gui executable. @<:@default=detect@:>@])],
   [want_shotgun_gui=$enableval],
   [want_shotgun_gui="auto"]
)

build_shotgun_gui="no"

if test "x$want_shotgun_gui" = "xyes" || test "x$want_shotgun_gui" = "xauto" ; then
   if test "x$want_shotgun_gui" = "xyes" ; then
      if test "x$build_azy" = "xno" || test "x$build_shotgun" = "xno" ; then
         AC_MSG_ERROR([azy and shotgun are required to build shotgun gui])
      else
         build_shotgun_gui="yes"
      fi
   else
      if test "x$build_azy" = "xno" || test "x$build_shotgun" = "xno" ; then
         AC_MSG_WARN([azy and shotgun are required to build shotgun gui])
      else
         build_shotgun_gui="yes"
      fi
   fi
fi

AC_MSG_CHECKING([whether shotgun gui is build])

if test "x$build_shotgun_gui" = "xyes" ; then
   PKG_CHECK_MODULES([SHOTGUN_GUI],
      [
       eet >= $min_efl_version
       evas >= $min_efl_version
       ecore-file >= $min_efl_version
       ecore-imf >= $min_efl_version
       edje >= $min_efl_version
       elementary >= $min_efl_version
       efx
      ],
      [build_shotgun_gui=yes],
      [build_shotgun_gui=no]
   )
fi

AM_CONDITIONAL([BUILD_SHOTGUN_GUI], [test "x${build_shotgun_gui}" != "xno"])

##############################

AC_ARG_WITH([edje-cc],
   [AC_HELP_STRING([--with-edje-cc=PATH],
                   [specify a specific path to edje_cc])],
   [
    edje_cc=$withval;
    AC_MSG_NOTICE([edje_cc explicitly set to $edje_cc])
   ],
   [edje_cc=$($PKG_CONFIG --variable=prefix edje)/bin/edje_cc])

AC_SUBST([edje_cc])

AC_ARG_ENABLE([eldbus],
   [AC_HELP_STRING([--disable-eldbus], [disable eldbus support. @<:@default=detect@:>@])],
   [want_eldbus=$enableval],
   [want_eldbus="auto"]
)

have_eldbus=no
if test "x$build_shotgun_gui" = "xyes" ; then
   if test "x$want_eldbus" = "xyes" || test "x$want_eldbus" = "xauto" ; then
      PKG_CHECK_MODULES([ELDBUS],
         [eldbus],
         [
          AC_DEFINE([HAVE_DBUS], [1], [DBUS support])
          have_eldbus="yes"
         ],
         [have_eldbus="no"]
      )
   else
       have_eldbus="no"
   fi
   if test "x$want_eldbus" = "xyes" ; then
      if test "x$have_eldbus" = "xno" ; then
         AC_MSG_ERROR([eldbus support requested, but not found by pkg-config.])
      fi
   else
      if test "x$have_eldbus" = "xno" ; then
         AC_MSG_WARN([eldbus not found by pkg-config. dbus support disabled])
      fi
   fi
fi

AC_ARG_ENABLE([sawedoff],
   [AC_HELP_STRING([--disable-sawedoff], [disable sawed-off shotgun module for enlightenment. @<:@default=yes@:>@])],
   [want_sawedoff=$enableval],
   [want_sawedoff="yes"]
)

build_sawedoff="no"
if test "x$want_sawedoff" = "xyes" ; then
   PKG_CHECK_MODULES([E], [enlightenment eldbus],
      [
       build_sawedoff="yes"
       MODULE_DIR=$(${PKG_CONFIG} --variable=modules enlightenment)
       release=$(${PKG_CONFIG} --variable=release enlightenment)
       MODULE_ARCH="$host_os-$host_cpu-$release"
       AC_DEFINE_UNQUOTED([MODULE_ARCH], [$MODULE_ARCH], ["Module architecture"])
       sawedoff_desktop="src/modules/sawed-off/module.desktop"
      ],
      [build_sawedoff="no"])
fi

AC_SUBST([MODULE_ARCH])

AM_CONDITIONAL([BUILD_SAWEDOFF], [test "x$build_sawedoff" = "xyes"])

AC_ARG_ENABLE(sawedoff-homedir-install,
  AS_HELP_STRING([--enable-sawedoff-homedir-install], [Install modules in homedir]),
  [MODULE_DIR="${HOME}/.e/e/modules"]
)

AC_SUBST([MODULE_DIR])


## SSE
build_cpu_sse="yes"
AC_MSG_CHECKING(whether to build sse code)
AC_ARG_ENABLE(cpu-sse,
  AS_HELP_STRING([--enable-cpu-sse], [enable sse code]),
  [
      if test "x$enableval" = "xyes" ; then
        oldcppflags="$CPPFLAGS"
        CPPFLAGS+=" -msse"
        AC_CHECK_HEADER(xmmintrin.h,
          [
            AC_MSG_RESULT(yes)
            AC_DEFINE(USE_SSE, 1, [Build sse Code])
            build_cpu_sse="yes"
           ],
          [
            AC_MSG_RESULT(no)
            build_cpu_sse="no"
          ])
        CPPFLAGS="$oldcppflags"
      else
        AC_MSG_RESULT(no)
        build_cpu_sse="no"
      fi
  ],
  [
    AC_MSG_RESULT($build_cpu_sse)
    if test "x$build_cpu_sse" = "xyes" ; then
      oldcppflags="$CPPFLAGS"
      CPPFLAGS+=" -msse"
      AC_CHECK_HEADER(xmmintrin.h,
        [
          AC_MSG_RESULT(yes)
          AC_DEFINE(USE_SSE, 1, [Build sse Code])
          build_cpu_sse="yes"
         ],
        [
          AC_MSG_RESULT(no)
          build_cpu_sse="no"
        ])
      CPPFLAGS="$oldcflags"
    fi
  ]
)
build_cpu_sse4="yes"
AC_MSG_CHECKING(whether to build sse4 code)
AC_ARG_ENABLE(cpu-sse4,
  AS_HELP_STRING([--enable-cpu-sse4], [enable sse4 code]),
  [
      if test "x$enableval" = "xyes" ; then
        oldcppflags="$CPPFLAGS"
        CPPFLAGS+=" -msse2 -msse4"
        AC_CHECK_HEADER(nmmintrin.h,
          [
            AC_MSG_RESULT(yes)
            AC_DEFINE(USE_SSE4, 1, [Build sse4 Code])
            build_cpu_sse4="yes"
           ],
          [
            AC_MSG_RESULT(no)
            build_cpu_sse4="no"
          ])
        CPPFLAGS="$oldcppflags"
      else
        AC_MSG_RESULT(no)
        build_cpu_sse4="no"
      fi
  ],
  [
    AC_MSG_RESULT($build_cpu_sse4)
    if test "x$build_cpu_sse4" = "xyes" ; then
      oldcppflags="$CPPFLAGS"
      CPPFLAGS+=" -msse2 -msse4"
      AC_CHECK_HEADER(nmmintrin.h,
        [
          AC_MSG_RESULT(yes)
          AC_DEFINE(USE_SSE4, 1, [Build sse4 Code])
          build_cpu_sse4="yes"
         ],
        [
          AC_MSG_RESULT(no)
          build_cpu_sse4="no"
        ])
      CPPFLAGS="$oldcppflags"
    fi
  ]
)
SSE_CFLAGS=
if test "x$build_cpu_sse" = "xyes" ; then
   SSE_CFLAGS+=" -msse"
fi
if test "x$build_cpu_sse4" = "xyes" ; then
   SSE_CFLAGS+=" -msse2 -msse4"
fi
AC_SUBST(SSE_CFLAGS)

m4_ifdef([v_rev],
   [
    EFL_COMPILER_FLAG([-Wshadow])
    EFL_COMPILER_FLAG([-Wall])
    EFL_COMPILER_FLAG([-Wextra])
   ])

AC_SUBST(MAELSTROM_REQUIRES)
AC_SUBST(AZY_REQUIRES)
AC_SUBST([AZY_CFLAGS])
AC_SUBST([AZY_LIBS])
AC_SUBST(EMAIL_REQUIRES)
AC_SUBST(SHOTGUN_REQUIRES)

AC_CHECK_HEADERS([Rpcdce.h])
EFL_CHECK_DOXYGEN([build_doc="yes"], [build_doc="no"])
# write output
AC_CONFIG_FILES([
Makefile
doc/azy.dox
azy.pc
email.pc
shotgun.pc
$sawedoff_desktop
rpm/$PACKAGE.spec
])
AC_OUTPUT

# report
txt_strip() {
  echo "[$]@" | sed -e 's/^[[ \t]]*\([[^ \t]]*\)[[ \t]]*$/\1/g'
}

echo
cat << SUMMARY_EOF
Summary:
 * project.........: $PACKAGE $VERSION
 * libraries.......:
     Email.........: $build_email
     AZY...........: $build_azy
     Shotgun.......: $build_shotgun
 * doc.............: $build_doc
 * prefix..........: $(txt_strip $prefix)
 * CFLAGS..........: $(txt_strip $CFLAGS)
 * LDFLAGS.........: $(txt_strip $LDFLAGS)
 * AZY_CFLAGS......: $AZY_CFLAGS
 * EMAIL_CFLAGS....: $EMAIL_CFLAGS
 * SHOTGUN_CFLAGS..: $SHOTGUN_CFLAGS
SUMMARY_EOF
echo
cat << FEATURES_EOF
Features:
 * Shotgun GUI.........: $build_shotgun_gui (dbus: $have_eldbus)
FEATURES_EOF
echo

cat << MODULES_EOF
Modules:
 * sawed-off...........: $build_sawedoff
MODULES_EOF
echo

cat << COMPILE_EOF
Compilation........: make (or gmake)
COMPILE_EOF
echo

cat << INSTALL_EOF
Installation.......: make all install (as root if needed, with 'su' or 'sudo')
INSTALL_EOF
echo