Merge pull request #4011 from fritsch/vdpau-settings
[vuplus_xbmc] / lib / cpluff / configure.ac
1 dnl Process this file with autoconf to produce a configure script.
2
3 dnl Copyright 2007 Johannes Lehtinen
4 dnl This configure.ac script is free software; Johannes Lehtinen gives
5 dnl unlimited permission to copy, distribute and modify it.
6
7 dnl Version information
8 dnl -------------------
9
10 dnl Version information
11 define(CP_M4_VERSION_MAJOR, [0])
12 define(CP_M4_VERSION_MINOR, [1])
13 define(CP_M4_VERSION_REV, [3])
14 define(CP_M4_RELEASE_VERSION, CP_M4_VERSION_MAJOR.CP_M4_VERSION_MINOR.CP_M4_VERSION_REV)
15
16 dnl Backwards compatibility information
17 define(CP_M4_ABI_COMPATIBILITY, [0.1])
18
19 dnl Library version information
20 define(CP_M4_C_LIB_VERSION, [0:3:0])
21 define(CP_M4_CXX_LIB_VERSION, [0:0:0])
22
23 # Autoconf initialization
24 # -----------------------
25 AC_INIT([C-Pluff], CP_M4_RELEASE_VERSION, [johannes.lehtinen@iki.fi], [cpluff])
26 AC_COPYRIGHT([Copyright 2007 Johannes Lehtinen
27 This configure script is free software; Johannes Lehtinen gives unlimited
28 permission to copy, distribute and modify it.])
29 AC_CONFIG_SRCDIR([libcpluff/cpluff.h])
30 AC_CONFIG_AUX_DIR([auxliary])
31 AC_CONFIG_HEADERS([config.h])
32
33 # Version information
34 # -------------------
35 CP_VERSION_MAJOR=CP_M4_VERSION_MAJOR
36 CP_VERSION_MINOR=CP_M4_VERSION_MINOR
37 AC_DEFINE([CP_ABI_COMPATIBILITY], "CP_M4_ABI_COMPATIBILITY", [The earliest ABI compatible version or undefined])
38 CP_C_LIB_VERSION=CP_M4_C_LIB_VERSION
39 CP_CXX_LIB_VERSION=CP_M4_CXX_LIB_VERSION
40 AC_SUBST([CP_VERSION_MAJOR])
41 AC_SUBST([CP_VERSION_MINOR])
42 AC_SUBST([CP_C_LIB_VERSION])
43 AC_SUBST([CP_CXX_LIB_VERSION])
44
45 # Automake initialization
46 # -----------------------
47 AM_INIT_AUTOMAKE([foreign])
48 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
49 AM_GNU_GETTEXT([external])
50 AM_GNU_GETTEXT_VERSION([0.16.1])
51
52 # C/C++ compiler settings
53 # -------------------
54 AC_LANG([C])
55 AC_PROG_CC
56 if test -z "$CC"; then
57   AC_MSG_ERROR([C compiler was not found (required)])
58 fi
59 AC_PROG_CC_C_O
60 AC_C_CONST
61 AC_LIBTOOL_DLOPEN
62 AC_LIBTOOL_WIN32_DLL
63 AC_PROG_LIBTOOL
64
65 # Other programs
66 # --------------
67 AC_PROG_LN_S
68
69 # For config.h
70 CPPFLAGS="$CPPFLAGS -I\$(top_builddir)"
71
72 # For cpluff.h and cpluffdef.h
73 CPPFLAGS="$CPPFLAGS -I\$(top_builddir)/libcpluff -I\$(top_srcdir)/libcpluff"
74
75 # Substitute variables for libcpluff and non-libcpluff components
76 AC_SUBST([LIBS_LIBCPLUFF])
77 AC_SUBST([LIBS_OTHER])
78
79 # Define shared library extension
80 # -------------------------------
81 AC_DEFINE_UNQUOTED([CP_SHREXT], ["$shrext_cmds"], [Shared library extension])
82
83 # Thread support checks
84 # ---------------------
85
86 # Check the options
87 AC_ARG_ENABLE([threads], AS_HELP_STRING([--enable-threads@<:@=TYPE@:>@], [enable multi-threading support (supported TYPEs are "Posix" and "Windows", default is to check support in this order)]))
88 case "$enable_threads" in
89   yes)
90         # Use the default auto detection
91         enable_threads=''
92         ;;
93   ''|no|Posix|Windows)
94         # Ok, legal value, no action needed
95         ;;
96   *)
97         AC_MSG_ERROR([$enable_threads threads not supported])
98         ;;
99 esac
100
101 # Only check for different thread types if threading not disabled
102 cp_threads=''
103 if test "$enable_threads" != no; then
104
105   # Check for Posix thread support
106   if test -z "$cp_threads" && \
107     ( test -z "$enable_threads" || test "$enable_threads" = Posix ); then
108     AC_MSG_CHECKING([for Posix threads])
109     AC_LINK_IFELSE(
110 [AC_LANG_SOURCE([#include <pthread.h>
111
112 int main(int argc, char **argv) {
113         pthread_mutex_t mutex;
114         
115         pthread_mutex_init(&mutex, NULL);
116         return 0;
117 }
118 ])], [AC_MSG_RESULT([yes])
119 cp_threads=Posix], AC_MSG_RESULT([no]))
120   fi
121   
122   # Check for Windows thread suppport
123   if test -z "$cp_threads" && \
124     ( test -z "$enable_threads" || test "$enable_threads" = Windows ); then
125     AC_MSG_CHECKING([for Windows threads])
126     AC_LINK_IFELSE(
127 [AC_LANG_SOURCE([#include <windows.h>
128
129 int main(int argc, char **argv) {
130   CreateMutex(NULL, FALSE, NULL);
131   return 0;
132 }
133 ])], [AC_MSG_RESULT([yes])
134 cp_threads=Windows], AC_MSG_RESULT([no]))
135   fi
136   
137   # Check if we got the desired thread support
138   if test -n "$enable_threads" && test "$enable_threads" != "$cp_threads"; then
139     AC_MSG_ERROR([$enable_threads threads not detected])
140   fi
141   
142 fi
143
144 if test -z "$cp_threads" && test "$enable_threads" != no; then
145   AC_MSG_WARN([multi-threading support not detected])
146 fi
147
148 if test -n "$cp_threads"; then
149         AC_DEFINE_UNQUOTED([CP_THREADS], ["$cp_threads"], [Multi-threading support type])
150 fi
151 AM_CONDITIONAL([POSIX_THREADS], test "$cp_threads" = Posix)
152 AM_CONDITIONAL([WINDOWS_THREADS], test "$cp_threads" = Windows)
153
154 # Check for the dlopen mechanism (Posix dlopen or GNU Libtool libltdl)
155 # --------------------------------------------------------------------
156 AC_ARG_WITH([dlopen],
157   AS_HELP_STRING([--with-dlopen],
158     [use the Posix dlopen facility]))
159 AC_ARG_WITH([libltdl],
160   AS_HELP_STRING([--with-libltdl],
161     [use the GNU Libtool libltdl]))
162 if test "$with_dlopen" = yes && test "$with_libltdl" = yes; then
163   AC_MSG_ERROR([Can not use both Posix dlopen and GNU Libtool libltdl])
164 fi
165 dlmechanism=none
166 if test "$with_dlopen" != no && test "$with_libltdl" != yes; then
167   AC_CHECK_HEADER([dlfcn.h],
168     AC_CHECK_LIB([dl], [dlopen],
169       [LIBS_LIBCPLUFF="-ldl $LIBS_LIBCPLUFF"; dlmechanism=dlopen],
170         AC_CHECK_LIB([c], [dlopen], [dlmechanism=dlopen])))
171 fi
172 if test "$dlmechanism" = none && test "$with_libltdl" != no && test "$with_dlopen" != yes; then  
173   AC_CHECK_HEADER([ltdl.h],
174     AC_CHECK_LIB([ltdl], [lt_dlopen],
175       [LIBS_LIBCPLUFF="-lltdl $LIBS_LIBCPLUFF"; dlmechanism=libltdl]))
176 fi
177 case "$dlmechanism" in
178   dlopen)
179     AC_DEFINE([DLOPEN_POSIX], [], [Define to use Posix dlopen])
180       ;;
181   libltdl)
182     AC_DEFINE([DLOPEN_LIBTOOL], [], [Define to use GNU Libtool libltdl])
183     ;;
184   *)
185     AC_MSG_ERROR([Either the Posix dlopen facility or GNU Libtool libltdl is required])
186     ;;
187 esac
188
189 # Check for Expat XML parsing library
190 # -----------------------------------
191 AC_CHECK_HEADER([expat.h],, AC_MSG_ERROR([Expat header file is required]))
192 AC_CHECK_LIB([expat], [XML_ParseBuffer], [LIBS_LIBCPLUFF="-lexpat $LIBS_LIBCPLUFF"], AC_MSG_ERROR([Expat library is required]))
193
194 # Check for the GNU Readline Library
195 # ----------------------------------
196 AC_ARG_WITH([readline],
197   AS_HELP_STRING([--with-readline],
198     [use the GNU Readline Library]))
199 have_readline=no
200 LIB_READLINE=
201 if test "$with_readline" != no; then
202   AC_CHECK_HEADER([readline/readline.h],
203     AC_CHECK_LIB([readline], [add_history], [LIB_READLINE="-lreadline"; have_readline=yes]))
204   if test "$with_readline" = yes && test "$have_readline" != yes; then
205     AC_MSG_ERROR([GNU readline requested but headers or library not found])
206   fi
207 fi
208 AC_SUBST([LIB_READLINE])
209 AM_CONDITIONAL([HAVE_READLINE], test "$have_readline" = yes)
210
211 # Link non-library parts with the C-Pluff library
212 # -----------------------------------------------
213 LIBS_OTHER="\$(top_builddir)/libcpluff/libcpluff.la $LIBS_OTHER"
214
215 # Check for stat/lstat functions
216 # ------------------------------
217 AC_CHECK_FUNCS([stat lstat])
218
219 # Debugging support
220 # -----------------
221 AC_ARG_ENABLE([debug],
222   AS_HELP_STRING([--enable-assertions], [enable assertion checks for debugging]))
223 if ! test "$enable_assertions" = yes; then
224   CPPFLAGS="$CPPFLAGS -DNDEBUG"
225 fi
226 AC_ARG_ENABLE([gcc-warnings],
227   AS_HELP_STRING([--enable-gcc-warnings],
228     [enable default set of GCC compiler warnings]))
229 if test "$enable_gcc_warnings" = yes; then
230   CFLAGS="$CFLAGS -Wall -pedantic -std=gnu99"
231 fi
232
233 # File name separator character
234 # -----------------------------
235 AC_MSG_CHECKING([which file name separator to use])
236 case "$host" in
237   *-*-mingw32* | *-*-windows*)
238         cp_fnamesep='\\'
239         ;;
240   *)
241         cp_fnamesep='/'
242         ;;
243 esac
244 AC_MSG_RESULT(['$cp_fnamesep'])
245 AC_DEFINE_UNQUOTED([CP_FNAMESEP_CHAR], ['$cp_fnamesep'], [File name separator character])
246 AC_DEFINE_UNQUOTED([CP_FNAMESEP_STR], ["$cp_fnamesep"], [File name separator string])
247
248 # Substitute C-Pluff loader for examples
249 # --------------------------------------
250 CPLUFF_LOADER="$bindir/cpluff-loader"
251 AC_SUBST(CPLUFF_LOADER)
252
253 # Output Makefiles
254 # ----------------
255 AC_CONFIG_FILES([Makefile
256 libcpluff/Makefile
257 libcpluff/cpluffdef.h
258 libcpluff/docsrc/Makefile
259 libcpluff/docsrc/Doxyfile-ref
260 libcpluff/docsrc/Doxyfile-impl
261 loader/Makefile
262 console/Makefile
263 po/Makefile.in
264 doc/Makefile
265 doc/img/Makefile
266 docsrc/Makefile
267 test/Makefile
268 test/plugins-source/Makefile
269 test/plugins-source/callbackcounter/Makefile
270 test/plugins-source/symuser/Makefile
271 test/plugins-source/symprovider/Makefile
272 examples/Makefile
273 examples/cpfile/Makefile
274 examples/cpfile/cpfile
275 examples/cpfile/plugins/Makefile
276 examples/cpfile/plugins/core/Makefile
277 examples/cpfile/plugins/special/Makefile
278 examples/cpfile/plugins/extension/Makefile
279 examples/cpfile/plugins/cext/Makefile])
280 AC_OUTPUT
281
282
283 # Print configuration information
284 # -------------------------------
285 AC_MSG_NOTICE([-----------------------------------------------------------])
286 AC_MSG_NOTICE([C-Pluff configuration])
287 AC_MSG_NOTICE([  release version:                $PACKAGE_VERSION])
288 if test -n "$cp_threads"; then
289   val="yes ($cp_threads)"
290 else
291   val=no
292 fi
293 AC_MSG_NOTICE([  multi-threading support:        $val])
294 AC_MSG_NOTICE([  dlopening mechanism:            $dlmechanism])
295 val=no
296 test "$USE_NLS" = no || val="yes (gettext)"
297 AC_MSG_NOTICE([  localization support:           $val])
298 AC_MSG_NOTICE([  use GNU readline library:       $have_readline])
299 if test "$enable_assertions" = yes; then
300   val=yes
301 else
302   val=no;
303 fi
304 AC_MSG_NOTICE([  assertion checks for debugging: $val])
305 AC_MSG_NOTICE([  file name separator character:  '$cp_fnamesep'])
306 AC_MSG_NOTICE([  compiler and linker settings:])
307 AC_MSG_NOTICE([    CC='$CC'])
308 AC_MSG_NOTICE([    CPPFLAGS='$CPPFLAGS'])
309 AC_MSG_NOTICE([    CFLAGS='$CFLAGS'])
310 AC_MSG_NOTICE([    LDFLAGS='$LDFLAGS'])
311 AC_MSG_NOTICE([    LIBS='$LIBS'])
312 AC_MSG_NOTICE([    LIBS_LIBCPLUFF='$LIBS_LIBCPLUFF'])
313 AC_MSG_NOTICE([    LIBS_OTHER='$LIBS_OTHER'])
314 AC_MSG_NOTICE([    LIB_READLINE='$LIB_READLINE'])
315 AC_MSG_NOTICE([    LTLIBINTL='$LTLIBINTL'])
316 AC_MSG_NOTICE([-----------------------------------------------------------])