Clean the code, fix warnings
[platform/upstream/libwlmessage.git] / configure.ac
1 m4_define([wlmessage_version], 0.1)
2
3 AC_PREREQ([2.64])
4 AC_INIT([wlmessage],
5         [wlmessage_version],
6         [https://bugs.tizen.org/],
7         [wlmessage],
8         [http://www.tizen.org/])
9
10 AC_SUBST([WLMESSAGE_VERSION], [wlmessage_version])
11
12 AC_CONFIG_AUX_DIR([build-aux])
13
14 AC_USE_SYSTEM_EXTENSIONS
15 AC_SYS_LARGEFILE
16
17 AM_INIT_AUTOMAKE([1.11 parallel-tests foreign no-dist-gzip dist-xz color-tests subdir-objects])
18
19 AM_SILENT_RULES([yes])
20
21 # Check for programs
22 AC_PROG_CC
23 AC_PROG_SED
24
25 # Initialize libtool
26 LT_PREREQ([2.2])
27 LT_INIT([disable-static])
28
29 PKG_PROG_PKG_CONFIG()
30
31 AC_CHECK_FUNC([dlopen], [],
32               AC_CHECK_LIB([dl], [dlopen], DLOPEN_LIBS="-ldl"))
33 AC_SUBST(DLOPEN_LIBS)
34
35 AC_CHECK_FUNCS([mkostemp strchrnul initgroups posix_fallocate])
36
37 AC_ARG_ENABLE(x11, [  --enable-x11],,
38               enable_x11=no)
39 AM_CONDITIONAL(ENABLE_X11, test x$enable_x11 = xyes)
40 if test x$enable_x11 = xyes; then
41         platform_libs="$platform_libs x11 xt xaw7"
42 fi
43
44 AC_ARG_ENABLE(wayland, [  --enable-wayland],,
45               enable_wayland=yes)
46 AM_CONDITIONAL(ENABLE_WAYLAND, test x$enable_wayland = xyes)
47 if test x$enable_wayland = xyes; then
48         platform_libs="$platform_libs wayland-client wayland-cursor xkbcommon"
49 fi
50
51 AC_ARG_ENABLE(xdg-shell,
52               AS_HELP_STRING([--enable-xdg-shell],
53                              [build with XDG-Shell support (Weston 1.5.0)]),
54                              [],[enable_xdg_shell=no])
55 AM_CONDITIONAL(ENABLE_XDG_SHELL, test x$enable_xdg_shell = xyes)
56 if test x$enable_xdg_shell = xyes; then
57         AC_DEFINE([ENABLE_XDG_SHELL], [1], [Build with XDG-Shell support])
58 fi
59
60 AC_ARG_ENABLE(egl,
61               AS_HELP_STRING([--disable-egl],
62                              [do not build with EGL support]),
63                              [],[enable_egl=yes])
64 AM_CONDITIONAL(ENABLE_EGL, test x$enable_egl = xyes)
65 if test x$enable_egl = xyes; then
66         AC_DEFINE([ENABLE_EGL], [1], [Build with EGL support])
67         PKG_CHECK_MODULES(EGL, [egl >= 7.10 glesv2])
68 fi
69
70 AC_ARG_WITH(cairo,
71             AS_HELP_STRING([--with-cairo=@<:@image|glesv2@:>@]
72                           [which Cairo renderer to use for the clients]),
73                            [],[with_cairo="image"])
74
75 if test "x$with_cairo" = "ximage"; then
76         cairo_modules="cairo"
77 else
78 if test "x$with_cairo" = "xglesv2"; then
79         cairo_modules="cairo-glesv2"
80 else
81         AC_ERROR([Unknown cairo renderer requested])
82 fi
83 fi
84
85 # Included for legacy compat
86 AC_ARG_WITH(cairo-glesv2,
87             AS_HELP_STRING([--with-cairo-glesv2],
88                            [use GLESv2 cairo]))
89 if test "x$with_cairo_glesv2" = "xyes"; then
90   cairo_modules="cairo-glesv2"
91   with_cairo="glesv2"
92 fi
93
94 if test "x$cairo_modules" = "xcairo-glesv2"; then
95 AC_DEFINE([USE_CAIRO_GLESV2], [1], [Use the GLESv2 GL cairo backend])
96 fi
97
98 if test x$enable_wayland = xyes && test x$enable_egl = xyes; then
99         cairo_modules="$cairo_modules wayland-egl"
100 fi
101
102 PKG_CHECK_MODULES(PIXMAN, [pixman-1])
103 PKG_CHECK_MODULES(PNG, [libpng])
104
105 AC_CHECK_LIB([jpeg], [jpeg_CreateDecompress], have_jpeglib=yes)
106 if test x$have_jpeglib = xyes; then
107   JPEG_LIBS="-ljpeg"
108 else
109   AC_ERROR([libjpeg not found])
110 fi
111 AC_SUBST(JPEG_LIBS)
112
113 PKG_CHECK_MODULES(GLIB, [glib-2.0 gio-2.0])
114
115 PKG_CHECK_MODULES(CLIENT, [$platform_libs cairo >= 1.10.0])
116
117   # Only check for cairo-egl if a GL or GLES renderer requested
118   AS_IF([test "x$cairo_modules" = "xcairo-glesv2"], [
119     PKG_CHECK_MODULES(CAIRO_EGL, [egl >= 7.10 cairo-egl >= 1.11.3 $cairo_modules],
120                       [have_cairo_egl=yes], [have_cairo_egl=no])
121     AS_IF([test "x$have_cairo_egl" = "xyes"],
122           [AC_DEFINE([HAVE_CAIRO_EGL], [1], [Have cairo-egl])],
123           [AC_ERROR([cairo-egl not used because $CAIRO_EGL_PKG_ERRORS])])],
124   [have_cairo_egl=no])
125
126 AM_CONDITIONAL(HAVE_CAIRO_GLESV2,
127                [test "x$have_cairo_egl" = "xyes" -a "x$cairo_modules" = "xcairo-glesv2" -a "x$enable_egl" = "xyes"])
128
129 AC_CONFIG_FILES([Makefile libwlmessage.pc])
130
131 AC_OUTPUT
132
133 AC_MSG_RESULT([
134         libxkbcommon                    ${enable_xkbcommon}
135 ])