fix pointer-to-int-cast error
[platform/core/uifw/libtbm.git] / configure.ac
1 #
2 #  Permission is hereby granted, free of charge, to any person obtaining a
3 #  copy of this software and associated documentation files (the "Software"),
4 #  to deal in the Software without restriction, including without limitation
5 #  on the rights to use, copy, modify, merge, publish, distribute, sub
6 #  license, and/or sell copies of the Software, and to permit persons to whom
7 #  the Software is furnished to do so, subject to the following conditions:
8 #
9 #  The above copyright notice and this permission notice (including the next
10 #  paragraph) shall be included in all copies or substantial portions of the
11 #  Software.
12 #
13 #  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 #  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 #  FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.  IN NO EVENT SHALL
16 #  ADAM JACKSON BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17 #  IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18 #  CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19
20 AC_PREREQ(2.60)
21 AC_INIT(libtbm, 1.1.0)
22 AC_USE_SYSTEM_EXTENSIONS
23 AC_CONFIG_SRCDIR([Makefile.am])
24 AM_INIT_AUTOMAKE([dist-bzip2])
25
26 AM_CONFIG_HEADER([config.h])
27
28 AC_DISABLE_STATIC
29 AC_PROG_LIBTOOL
30 AC_PROG_CC
31
32 AC_HEADER_STDC
33 AC_SYS_LARGEFILE
34 AC_FUNC_ALLOCA
35
36 # Enable quiet compiles on automake 1.11.
37 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
38
39 dnl Make sure the pkg-config macros are defined
40 m4_ifndef([PKG_PROG_PKG_CONFIG],
41     [m4_fatal([Could not locate the pkg-config autoconf macros.
42   These are usually located in /usr/share/aclocal/pkg.m4. If your macros
43   are in a different location, try setting the environment variable
44   ACLOCAL="aclocal -I/other/macro/dir" before running autoreconf.])])
45 PKG_PROG_PKG_CONFIG()
46
47 # set the dir for the tbm module
48 DEFAULT_BUFMGR_MODULE_PATH="/usr/lib/bufmgr"
49 AC_ARG_WITH(bufmgr-module-path, AS_HELP_STRING([--with-bufmgr-module-path=PATH], [tbm bufmgr module dir]),
50                                 [ BUFMGR_MODULE_PATH="$withval" ],
51                                 [ BUFMGR_MODULE_PATH="${DEFAULT_BUFMGR_MODULE_PATH}" ])
52
53 # set the window system platform where the bufmgr initializes
54 AC_ARG_WITH(tbm-platform, AS_HELP_STRING([--with-tbm-platform=WINSYS], [tbm platform (default: X11)]),
55                                 [ TBM_PLATFORM="$withval" ],
56                                 [ TBM_PLATFORM="X11" ])
57 AC_SUBST(TBM_PLATFORM)
58
59 #AC_DEFINE(BUFMGR_MODULE_DIR, "${BUFMGR_MODULE_PATH}", [Directory for the modules of tbm_bufmgr])
60 AC_DEFINE_UNQUOTED(BUFMGR_MODULE_DIR, "${BUFMGR_MODULE_PATH}", [Directory for the modules of tbm_bufmgr])
61
62 AC_CHECK_FUNCS([clock_gettime], [CLOCK_LIB=],
63                [AC_CHECK_LIB([rt], [clock_gettime], [CLOCK_LIB=-lrt],
64                              [AC_MSG_ERROR([Couldn't find clock_gettime])])])
65 AC_SUBST([CLOCK_LIB])
66
67
68 if test "x$TBM_PLATFORM" = "xX11"; then
69     PKG_CHECK_MODULES(LIBDRI2, libdri2)
70     PKG_CHECK_MODULES(X11, x11)
71     LIBTBM_CFLAGS="$LIBDRI2_CFLAGS $X11_CFLAGS"
72     LIBTBM_LIBS="$LIBDRI2_LIBS $X11_LIBS"
73 fi
74
75 if test "x$TBM_PLATFORM" = "xWAYLAND"; then
76     PKG_CHECK_MODULES(WAYLAND_CLIENT, wayland-client)
77     LIBTBM_CFLAGS="$WAYLAND_CLIENT_CFLAGS"
78     LIBTBM_LIBS="$WAYLAND_CLIENT_LIBS"
79
80         WAYLAND_PREFIX=`$PKG_CONFIG --variable=prefix wayland-client`
81     AC_PATH_PROG([WAYLAND_SCANNER], [wayland-scanner],,
82                     [${WAYLAND_PREFIX}/bin$PATH_SEPARATOR$PATH])
83 fi
84
85 PKG_CHECK_MODULES(CAPI, [capi-base-common >= 0.1.1], [capi_0.1.1=yes], [capi_0.1.1=no])
86 if test x"$capi_0.1.1" = xyes; then
87         AC_DEFINE(HAVE_CAPI_0_1_1,1,[The version of capi-base-common is over 0.1.1])
88 fi
89
90 PKG_CHECK_MODULES(LIBDRM, libdrm)
91 PKG_CHECK_MODULES(PTHREADSTUBS, pthread-stubs)
92
93 LIBTBM_CFLAGS+="$LIBTBM_CFALGS $LIBDRM_CFLAGS $PTHREADSTUBS_CFLAGS $CAPI_CFLAGS"
94 LIBTBM_LIBS+="$LIBTBM_LIBS $LIBDRM_LIBS $PTHREADSTUBS_LIBS $CAPI_LIBS"
95 AC_SUBST(LIBTBM_CFLAGS)
96 AC_SUBST(LIBTBM_LIBS)
97
98 if test "x$TBM_PLATFORM" = "xX11"; then
99         AC_DEFINE(HAVE_X11,1,[The window system is X11.])
100 else
101         AC_DEFINE(HAVE_WAYLAND,1,[The window system is WAYLAND.])
102 fi
103
104 HOST_CPU_X86_64=no
105 case $host_cpu in
106   x86_64*|amd64*)
107     HOST_CPU_X86_64=yes
108 esac
109
110 AM_CONDITIONAL(HAVE_TBM_PLATFORM_X11, test "x$TBM_PLATFORM" = "xX11")
111 AM_CONDITIONAL(HAVE_TBM_PLATFORM_WAYLAND, test "x$TBM_PLATFORM" = "xWAYLAND")
112 AM_CONDITIONAL(HOST_CPU_X86_64, test "x$HOST_CPU_X86_64" = "xyes")
113
114 AC_OUTPUT([
115     src/Makefile
116         src/wayland-drm/Makefile
117     drm_slp/Makefile
118         Makefile
119         libtbm.pc])
120
121 echo ""
122 echo "CFLAGS            : $CFLAGS"
123 echo "LDFLAGS           : $LDFLAGS"
124 echo "LIBTBM_CFLAGS     : $LIBTBM_CFLAGS"
125 echo "LIBTBM_LIBS       : $LIBTBM_LIBS"
126 echo "BUFMGR_MODULE_DIR : $BUFMGR_MODULE_PATH"
127 echo "TBM_PLATFORM      : $TBM_PLATFORM"
128 echo ""
129