Imported Debian patch 0.1.0+git20131207+e452e83-0ubuntu12
[deb_libhybris.git] / hybris / configure.ac
1 AC_INIT([libhybris], [0.1.0])
2 AC_CONFIG_SRCDIR([Makefile.am])
3 AC_CONFIG_HEADERS(config.h)
4 AM_INIT_AUTOMAKE([dist-bzip2 subdir-objects])
5 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
6
7 # If library source has changed since last release, increment revision
8 # If public symbols have been added, removed or changed since last release,
9 # increment current and set revision to 0
10 # If public symbols have been added since last release, increment age
11 # If public symbols have been removed since last release, set age to 0
12 m4_define([hybris_lt_current], [1])
13 m4_define([hybris_lt_revision], [0])
14 m4_define([hybris_lt_age], [0])
15
16 AC_PROG_CC
17 AC_PROG_CXX
18 AM_PROG_CC_C_O
19 AC_GNU_SOURCE
20 AC_DISABLE_STATIC
21 AC_PROG_LIBTOOL
22
23 AC_SUBST(CFLAGS)
24 AC_SUBST(CPPFLAGS)
25 AC_SUBST(LDFLAGS)
26
27 PKG_PROG_PKG_CONFIG
28
29 LT_CURRENT=hybris_lt_current
30 LT_REVISION=hybris_lt_revision
31 LT_AGE=hybris_lt_age
32 AC_SUBST([LT_CURRENT])
33 AC_SUBST([LT_REVISION])
34 AC_SUBST([LT_AGE])
35
36 AC_CHECK_LIB(dl, dlopen, dummy=yes, AC_MSG_ERROR(dynamic linking loader is required))
37 AC_CHECK_LIB(rt, clock_gettime, dummy=yes, AC_MSG_ERROR(librt is required))
38
39 AC_ARG_ENABLE(debug,
40 [ --enable-debug Enable debug build (default=disabled)],
41 [debug=$enableval],
42 [debug="no"])
43 AM_CONDITIONAL( [WANT_DEBUG], [test x"$debug" = x"yes"])
44
45 AC_ARG_ENABLE(trace,
46 [ --enable-trace Enable TRACE statements (default=disabled)],
47 [trace=$enableval],
48 [trace="no"])
49 AM_CONDITIONAL( [WANT_TRACE], [test x"$trace" = x"yes"])
50
51 AC_ARG_ENABLE(mesa,
52 [ --enable-mesa Enable mesa headers (default=disabled)],
53 [mesa=$enableval],
54 [mesa="no"])
55 AM_CONDITIONAL( [WANT_MESA], [test x"$mesa" = x"yes"])
56
57 AC_ARG_ENABLE(wayland,
58 [ --enable-wayland Enable wayland support (default=disabled)],
59 [wayland=$enableval
60 PKG_CHECK_MODULES(WAYLAND_CLIENT, wayland-client,, exit)
61 PKG_CHECK_MODULES(WAYLAND_SERVER, wayland-server,, exit)
62 WAYLAND_PREFIX=`$PKG_CONFIG --variable=prefix wayland-client`
63
64 AC_PATH_PROG([WAYLAND_SCANNER], [wayland-scanner],, [${WAYLAND_PREFIX}/bin$PATH_SEPARATOR$PATH])
65 AC_DEFINE(WANT_WAYLAND, [], [We want Wayland support])
66 ],
67 [wayland="no"])
68 AM_CONDITIONAL( [WANT_WAYLAND], [test x"$wayland" = x"yes"])
69
70
71 AC_ARG_ENABLE(arch,
72 [ --enable-arch[=arch] Compile specific CPU target(default=arm)
73 arm: compile for ARM
74 x86: Compile for x86],
75 [ if test "x$enableval" = "xarm" ; then
76 arch="arm"
77 elif test "x$enableval" = "xx86" ; then
78 arch="x86"
79 else
80 echo
81 echo "Error!"
82 echo "Unknown architecture' type"
83 exit 1
84 fi
85 ],
86 [arch="arm"]
87 )
88 AM_CONDITIONAL([WANT_ARCH_ARM], [test x$arch = xarm])
89 AM_CONDITIONAL([WANT_ARCH_X86], [test x$arch = xx86])
90
91 DEFAULT_EGL_PLATFORM="null"
92 AC_ARG_WITH(default-egl-platform,
93 [ --with-default-egl-platform=NAME Use NAME as default EGL platform if not specified by environment ],
94 [ DEFAULT_EGL_PLATFORM="$withval" ],
95 [ ])
96 AC_SUBST(DEFAULT_EGL_PLATFORM)
97
98 DEFAULT_HYBRIS_LD_LIBRARY_PATH="/vendor/lib:/system/lib"
99 AC_ARG_WITH(default-hybris-ld-library-path,
100 [ --with-default-hybris-ld-library-path=PATH1:PATH2:... Use PATH1:PATH2 for default HYBRIS_LD_LIBRARY_PATH if not specified by environment ],
101 [ DEFAULT_HYBRIS_LD_LIBRARY_PATH="$withval" ],
102 [ ])
103 AC_SUBST(DEFAULT_HYBRIS_LD_LIBRARY_PATH)
104
105
106 android_headers_path=""
107 AC_ARG_WITH(android-headers,
108 [ --with-android-headers=DIR Use android headers available in DIR. See utils/extract-headers.sh ],
109 [
110 if [ ! test -e $withval/android-version.h ]; then
111 echo "Error! missing android-version.h in android header path"
112 exit 1
113 fi
114 rm -f include/android
115 ln -sf $withval include/android
116 android_headers_path="$withval"
117
118 # According to http://en.wikipedia.org/wiki/Android_version_history#Version_history_by_API_level
119 android_headers_major=`grep -E "define ANDROID_VERSION_MAJOR " $android_headers_path/android-version.h | sed "s|^\#define ANDROID_VERSION_MAJOR \(.*\)$|\1|g"`
120
121 android_headers_minor=`grep -E "define ANDROID_VERSION_MINOR " $android_headers_path/android-version.h | sed "s|^\#define ANDROID_VERSION_MINOR \(.*\)$|\1|g"`
122
123 android_headers_patch=`grep -E "define ANDROID_VERSION_PATCH " $android_headers_path/android-version.h | sed "s|^\#define ANDROID_VERSION_PATCH \(.*\)$|\1|g"`
124
125 if [ test "x$android_headers_major" = x ]; then
126 echo "Error! Was unable to locate define ANDROID_VERSION_MAJOR in $android_headers_path/android-version.h"
127 fi
128
129 AC_SUBST(ANDROID_VERSION_MAJOR, [$android_headers_major])
130 AC_SUBST(ANDROID_VERSION_MINOR, [$android_headers_minor])
131 AC_SUBST(ANDROID_VERSION_PATCH, [$android_headers_patch])
132
133 echo "Android headers version is $android_headers_major.$android_headers_minor.$android_headers_patch"
134 ],
135 [
136 echo "Error! need to provide path to Android headers --with-android-headers=DIR. See utils/extract-headers.sh"
137 exit 1
138 ]
139 )
140
141 # Add automake tests for version/API needs here that you need in code, including test .am's
142
143 AM_CONDITIONAL([HAS_ANDROID_4_2_0], [test $android_headers_major -ge 4 -a $android_headers_minor -ge 2 ])
144 AM_CONDITIONAL([HAS_ANDROID_4_1_0], [test $android_headers_major -ge 4 -a $android_headers_minor -ge 1 ])
145 AM_CONDITIONAL([HAS_ANDROID_4_0_0], [test $android_headers_major -ge 4 -a $android_headers_minor -ge 0 ])
146 AM_CONDITIONAL([HAS_ANDROID_2_3_0], [test $android_headers_major -ge 2 -a $android_headers_minor -ge 3 ])
147
148 AM_CONDITIONAL([HAS_LIBNFC_NXP_HEADERS], [test -f ${android_headers_path}/libnfc-nxp/phLibNfc.h])
149
150 AC_CONFIG_FILES([
151 Makefile
152 properties/Makefile
153 properties/libandroid-properties.pc
154 common/Makefile
155 common/gingerbread/Makefile
156 common/ics/Makefile
157 common/jb/Makefile
158 egl/egl.pc
159 egl/Makefile
160 egl/platforms/Makefile
161 egl/platforms/common/Makefile
162 egl/platforms/common/hybris-egl-platform.pc
163 egl/platforms/null/Makefile
164 egl/platforms/fbdev/Makefile
165 egl/platforms/wayland/Makefile
166 egl/platforms/hwcomposer/Makefile
167 egl/platforms/hwcomposer/hwcomposer-egl.pc
168 glesv1/glesv1_cm.pc
169 glesv1/Makefile
170 glesv2/glesv2.pc
171 glesv2/Makefile
172 hardware/Makefile
173 hardware/libhardware.pc
174 libnfc_nxp/Makefile
175 libnfc_nxp/libnfc_nxp.pc
176 libnfc_ndef_nxp/Makefile
177 libnfc_ndef_nxp/libnfc_ndef_nxp.pc
178 libsync/Makefile
179 libsync/libsync.pc
180 ui/Makefile
181 sf/Makefile
182 sf/libsf.pc
183 input/Makefile
184 input/libis.pc
185 camera/Makefile
186 camera/libcamera.pc
187 include/Makefile
188 utils/Makefile
189 tests/Makefile
190 ])
191
192 AM_COND_IF([WANT_WAYLAND], [AC_CONFIG_FILES([egl/platforms/common/wayland-egl.pc])])
193 AC_OUTPUT
194
195 echo
196 echo "------------------------------------------------------------------------"
197 echo "$PACKAGE_NAME $PACKAGE_VERSION"
198 echo "------------------------------------------------------------------------"
199 echo
200 echo "Configuration Options:"
201 echo
202 echo " debug build.............: $debug"
203 echo
204 echo " trace...................: $trace"
205 echo
206 echo " prefix..................: $prefix"
207 echo
208 echo " arch ..................: $arch"
209 echo
210 echo " headers path ...........: $android_headers_path"
211 echo
212 echo " default egl platform ...: $DEFAULT_EGL_PLATFORM"
213 echo
214 echo " default ld_library_path.: $DEFAULT_HYBRIS_LD_LIBRARY_PATH"
215 echo
216 echo "------------------------------------------------------------------------"
217 echo
218 echo "Now type 'make' to compile and 'make install' to install this package."
219