added docs about new gstreamer
[mediagoblin.git] / configure.ac
CommitLineData
e342891a
BI
1dnl configure.ac
2dnl
3dnl Copyright 2012, 2013 Brandon Invergo <brandon@invergo.net>
07778a69 4dnl 2014 MediaGoblin contributors (see MediaGoblin's AUTHORS)
e342891a
BI
5dnl
6dnl Copying and distribution of this file, with or without modification,
7dnl are permitted in any medium without royalty provided the copyright
8dnl notice and this notice are preserved. This file is offered as-is,
9dnl without any warranty.
10
11dnl#########
12dnl README #
13dnl#########
14dnl
15dnl This is a basic Autoconf configure.ac file for Python-based
16dnl projects. It is not intended to be used as-is, but rather to be
17dnl modified to the specific needs of the project.
18dnl
19dnl Lines prefixed with "dnl" are comments that are automatically
20dnl removed by Autoconf/M4, thus they will not appear in the generated
21dnl configure script (see the M4 documentation for more information).
22dnl Such comments are used in this file to communicate information to
23dnl you, the developer. In some cases, the comments contain extra
24dnl macros that you might consider including in your configure script.
25dnl If you wish to include them, simply remove the "dnl" from the
26dnl beginning of the line.
27dnl
28dnl Lines prefixed with "#" are comments that will appear in the
29dnl generated configure script. These comments are thus used to clarify
30dnl to the user what is happening in that script
31dnl
32dnl Wherever pyconfigure-specific macros are used, extra comments are
33dnl included to describe the macros.
34
35dnl######################
36dnl Package Information #
37dnl######################
38
39dnl----
40dnl Initialize Autoconf with the package metadata
41dnl The arguments have been set via the project's PKG-INFO file
42dnl and correspond to:
43dnl
44dnl 1) package name (i.e. foo)
45dnl 2) package version (i.e. 1.2)
46dnl 3) bug/info/project email address (i.e. bug-foo@gnu.org)
47dnl----
48dnl
96f9c530 49AC_INIT([mediagoblin], [0.7.1.dev], [cwebber@gnu.org])
e342891a 50
a9dc855a 51
e342891a
BI
52dnl----
53dnl Load macros from the m4/ directory. If you plan to write new
54dnl macros, put them in files in this directory.
55dnl----
56dnl
0e58f810 57dnl AC_CONFIG_MACRO_DIR([m4])
e342891a
BI
58
59
07778a69
CAW
60dnl # The default prefix should be changed from /usr/local. Set it, as in
61dnl # the documentation, to /srv/mediagoblin.example.org/mediagoblin/
62dnl AC_PREFIX_DEFAULT([`pwd`])
dc85ee8c
BI
63
64
e342891a
BI
65dnl###########################
66dnl Program/command support #
67dnl###########################
68dnl
69dnl In this section, we check for the presence of important commands
70dnl and programs.
71
50e53328
CAW
72dnl--A bit simpler python init----------------------------------------
73dnl Expect python2.7 or python2.6 unless --with-python3 is given.
74dnl----
75
76
96f9c530
CAW
77AC_ARG_WITH([python3],
78 [AS_HELP_STRING([--with-python3], [Set up to use Python 3 by default.])],
79 [],
80 [with_python3=no])
81AS_IF([test "x$with_python3" != xno],
82 AC_CHECK_PROGS([PYTHON], [python3.3], [none])
41c6732e 83 AC_SUBST([USE_PYTHON3], [true])
96f9c530
CAW
84 AS_IF([test "x$PYTHON" = xnone],
85 [AC_MSG_FAILURE(
86 [--with-python3 given but no acceptable python3 (3.3) could be found])]),
87 AC_CHECK_PROGS([PYTHON], [python2.7 python2.6], [none])
41c6732e 88 AC_SUBST([USE_PYTHON3], [false])
96f9c530
CAW
89 AS_IF([test "x$PYTHON" = xnone],
90 [AC_MSG_FAILURE(
f8c1e11f 91 [No acceptable python (2.7, 2.6) could be found])]))
96f9c530
CAW
92
93
e342891a
BI
94dnl--PC_INIT----------------------------------------------------------
95dnl This is the only required macro. Its primary function is to find
96dnl a Python interpreter that is compatible with the package and set
97dnl the PYTHON variable to hold its path. It can optionally take
a9dc855a
CAW
98dnl arguments to specify minimum and/or maximum versions. This is a
99dnl convenience macro that combines the functionality of the macros
100dnl PC_PROG_PYTHON and PC_PYTHON_VERIFY_VERSION
e342891a
BI
101dnl PC_INIT: find an interpreter with a version between 2.0 and 3.3.99
102dnl (in other words, up to and including any possible release
103dnl in the 3.3 series)
104dnl PC_INIT([MIN_VER], [MAX_VER]): Find an interpreter that is between
105dnl the minimum and maximum version. If the min is in the 2.0
106dnl series and the max is in the 3.0 series, non-existent
107dnl releases (2.8 & 2.9) will be correctly skipped.
108dnl----
109dnl
96f9c530 110dnl PC_INIT([3.3], [3.4])
a9dc855a
CAW
111
112dnl--PC_PROG_PYTHON---------------------------------------------------
113dnl This macro provides a means of finding a Python interpreter.
114dnl You may optionally pass it argument to pass a path to a binary to
115dnl check for first. You may also pass a second and third argument to
116dnl specify the minimum and maximum versions to check for. This works
117dnl in a naive way by appending the major and minor release numbers to
118dnl the binary name. By default, this will first check for a binary
119dnl called "python" and then from there it will check for version-
120dnl specific binaries (ie "python3", "python2.7") in decending version
121dnl order. Thus, the highest version binary will be found first.
122dnl----
123dnl
124dnl PC_PROG_PYTHON
125
e342891a
BI
126
127dnl--PC_PYTHON_PROG_PYTHON_CONFIG-------------------------------------
128dnl In order to use some of the other macros, you also need the
129dnl python-config command, which will fall subject to the same problem
130dnl of python3-config being preferred to python2-config. This macro
131dnl will be automatically included if you use on of the macros that
132dnl depends on it, so you normally don't have to call it. However, if
133dnl you require a specific version, you can do something like the
134dnl following example.
135dnl----
136dnl
96f9c530
CAW
137dnl PC_PYTHON_PROG_PYTHON_CONFIG([python2-config])
138dnl if [[ "x$PYTHON_CONFIG" == "x" ]]; then
139dnl PC_PYTHON_PROG_PYTHON_CONFIG([$PYTHON-config])
140dnl fi
e342891a
BI
141
142dnl----
143dnl With the following set of macros, we implement an option
144dnl "--with-virtualenv", which the user can pass to the configure
145dnl script in order to install to a Virtualenv (AC_ARG_WITH). If the
146dnl option is specified by the user, then we check if the program is
147dnl available, checking both for "virtualenv" and "virtualenv2"
148dnl (AC_CHECK_PROGS)
149dnl----
150dnl
07778a69 151# Support doing development in a virtualenv via the --with-virtualenv
e342891a
BI
152# configure flag
153AC_ARG_WITH([virtualenv],
07778a69 154 [AS_HELP_STRING([--without-virtualenv], [install to a Python virtualenv])],
e342891a 155 [],
07778a69 156 [with_virtualenv=yes])
e342891a
BI
157AS_IF([test "x$with_virtualenv" != xno],
158 AC_CHECK_PROGS([VIRTUALENV], [virtualenv virtualenv3 virtualenv2], [no])
159 AS_IF([test "x$VIRTUALENV" = xno],
160 [AC_MSG_FAILURE(
161 [--with-virtualenv given but virtualenv could not be found])]),
162 AC_SUBST([VIRTUALENV], [no]))
163AC_ARG_VAR([VIRTUALENV_FLAGS], [flags to pass to the virtualenv command])
164
165dnl----
166dnl If the program uses sphinx-build to build documentation, uncomment
167dnl this to create a SPHINXBUILD variable in the Makefile pointing to
168dnl the program. Thus, the user would specify
169dnl SPHINXBUILD=/path/to/sphinx-build as an argument to the configure
170dnl script. Since building the documentation should be optional, just
171dnl print a warning. If the program uses some other documentation
172dnl system, you can do something similar with it.
173dnl----
174dnl
96f9c530
CAW
175dnl # Check for sphinx-build
176dnl AC_CHECK_PROGS([SPHINXBUILD], [sphinx-build sphinx-build3 sphinx-build2], [no])
177dnl AS_IF([test "x$SPHINXBUILD" = xno],
178dnl AC_MSG_WARN(sphinx-build is required to build documentation))
e342891a
BI
179
180
181dnl----
182dnl These two are standard Autoconf macros which check for the
183dnl presence of some programs that we will use in the Makefile.
184dnl----
185dnl
186AC_PROG_MKDIR_P
187AC_PROG_INSTALL
188
96f9c530
CAW
189dnl########################################
190dnl Database stuff... maybe restore this? #
191dnl########################################
192dnl # Check for a supported database program
193dnl AC_PATH_PROG([SQLITE], [sqlite3])
194dnl AC_PATH_PROG([POSTGRES], [psql])
195dnl AS_IF([test "x$SQLITE" = x -a "x$POSTGRES" = "x"],
196dnl [AC_MSG_ERROR([SQLite or PostgreSQL is required])])
e342891a 197
c62d1744 198
a9dc855a
CAW
199dnl#################################
200dnl Python installation properties #
201dnl#################################
202dnl
203dnl In this section, we test for various aspects of the Python
204dnl installation on the user's computer.
205
206dnl--PC_PYTHON_VERIFY_VERSION & PC_PYTHON_CHECK_VERSION----------------
207dnl PC_PYTHON_VERIFY_VERSION is used to check if the version of the
208dnl discovered Python binary meets some requirement. The first argument
209dnl should be a Python-compatible numerical comparison operator (i.e.
210dnl "==", "<", ">=", etc.). The second argument should be the version to
211dnl test against. Finally, you may optionally provide actions to take if
212dnl it does (3rd argument) or if it does not (4th argument) meet the
213dnl requirement.
214dnl
215dnl PC_PYTHON_CHECK_VERSION simply fetches the version number of the
216dnl Python interpreter stored in the PYTHON variable
217dnl----
218dnl
219dnl PC_PYTHON_VERIFY_VERSION([>=], [2.7.1], [AC_MSG_RESULT([yes])],
220dnl AC_MSG_FAILURE(Python 2 (python_min_ver+) is required))
221
222
223dnl--PC_PYTHON_CHECK_PREFIX--------------------------------------------
224dnl This macro finds out what Python thinks is the PREFIX
225dnl (i.e. /usr) and stores it in PYTHON_PREFIX. You probably shouldn't
226dnl use this and you should just stick to $prefix, but here it is
227dnl anyway.
228dnl----
229dnl
230dnl PC_PYTHON_CHECK_PREFIX
231
232
233dnl--PC_PYTHON_CHECK_EXEC_PREFIX---------------------------------------
234dnl The same as above but for $exec-prefix
235dnl----
236dnl
237dnl PC_PYTHON_CHECK_EXEC_PREFIX
238
239
240dnl--PC_PYTHON_CHECK_PLATFORM------------------------------------------
241dnl This macro checks what platform Python thinks this is (ie
242dnl "linux2") and stores it in PYTHON_PLATFORM
243dnl----
244dnl
245dnl PC_PYTHON_CHECK_PLATFORM
246
247
248dnl--PC_PYTHON_CHECK_SITE_DIR------------------------------------------
249dnl This checks where Python packages are installed (usually
250dnl /usr/lib/pythonX.Y/site-packages) and stores it in the variable
251dnl pythondir.
252dnl----
253dnl
254dnl PC_PYTHON_CHECK_SITE_DIR
255
256
e342891a
BI
257dnl--PC_PYTHON_SITE_PACKAGE_DIR---------------------------------------
258dnl This uses PYTHON_SITE_DIR to construct a directory for this
259dnl project (ie $PYTHON_SITE_DIR/project_name) and stores it in
260dnl pkgpythondir. This value is used by Automake for installing Python
261dnl scripts. By default, this begins with $pythondir, unexpanded, to
262dnl provide compatibility with GNU Makefile specifications, allowing
263dnl the user to change the prefix from the commandline.
264dnl----
265dnl
96f9c530 266dnl PC_PYTHON_SITE_PACKAGE_DIR
e342891a 267
a9dc855a
CAW
268
269dnl--PC_PYTHON_CHECK_EXEC_DIR------------------------------------------
270dnl Same as PC_PYTHON_CHECK_SITE_DIR but for $exec-prefix. Stored in
271dnl pyexecdir
272dnl----
273dnl
274dnl PC_PYTHON_CHECK_EXEC_DIR
275
e342891a
BI
276dnl--PC_PYTHON_EXEC_PACKAGE_DIR----------------------------------------
277dnl Same as PC_PYTHON_SITE_PACKAGE_DIR but for $exec-prefix. Stored in
278dnl pkgpyexecdir
279dnl----
280dnl
96f9c530 281dnl PC_PYTHON_EXEC_PACKAGE_DIR
e342891a
BI
282
283
284dnl###############################
285dnl Checking Python capabilities #
286dnl###############################
287
288dnl--PC_PYTHON_CHECK_MODULE([PYTHON-MODULE], [ACTION-IF-PRESENT],
289dnl [ACTION-IF-ABSENT])
290dnl This macro lets you check if a given Python module exists on the
291dnl system.
292dnl----
293dnl
294dnl PC_PYTHON_CHECK_MODULE([foo])
295
a9dc855a 296
96f9c530
CAW
297dnl # Check for python-lxml module
298dnl PC_PYTHON_CHECK_MODULE([lxml], [],
299dnl [AC_MSG_ERROR([python-lxml is required])])
300dnl
301dnl # Check for the Python Imaging Library
302dnl PC_PYTHON_CHECK_MODULE([Image], [],
303dnl [AC_MSG_ERROR([Python Imaging Library is required])])
e342891a
BI
304
305
a9dc855a
CAW
306dnl--PC_PYTHON_CHECK_FUNC([PYTHON-MODULE], [FUNCTION], [ARGS],
307dnl [ACTION-IF-SUCCESSFUL], [ACTION-IF-FAIL])
308dnl
309dnl This macro lets you test if a given function, possibly contained
310dnl in a given module, exists. If any exception is encountered when
311dnl calling this function, the check will fail.
312dnl----
313dnl
314dnl # test if Python library foo can do bar()
315dnl PC_PYTHON_CHECK_FUNC([foo], [bar])
316
317
318dnl Advanced notes:
319dnl m4/python.m4 implements Python as a language in Autoconf. This
320dnl means that you can use all the usual AC_LANG_* macros with Python
321dnl and it will behave as expected. In particular, this means that you
322dnl can run arbitrary Python code. For example:
323dnl
324dnl AC_LANG_PUSH(Python)[]
325dnl AC_RUN_IFELSE([AC_LANG_PROGRAM([dnl
326dnl # some code here
327dnl import foo
328dnl ], [dnl
329dnl # some more code here
330dnl foo.bar()
331dnl ])], [ACTION-IF-SUCCESSFUL], [ACTION-IF-FAILED])
332dnl AC_LANG_POP(Python)[]
333dnl
334dnl As usual, AC_LANG_PROGRAM takes two arguments, PROLOG code and
335dnl MAIN code. The PROLOG code goes verbatim at the top of the file,
336dnl while the MAIN code is embedded in an if __name__ == "__main__":
337dnl block. Python's indentation rules complicate things, however. In
338dnl particular, you must be sure that all of the code in MAIN is
339dnl indented once by default. PROLOG code does not require this.
340
341
342dnl##################################
343dnl Python module build environment #
344dnl##################################
345dnl
346dnl Here we check for necessary information for building Python modules
347dnl written in C
348
349dnl--PC_PYTHON_CHECK_INCLUDES------------------------------------------
350dnl This macro figures out the include flags necessary for loading the
351dnl Python headers (ie -I/usr/lib/python). The results are stored in
352dnl PYTHON_INCLUDES
353dnl----
354dnl
355dnl PC_PYTHON_CHECK_INCLUDES
356
357
358dnl--PC_PYTHON_CHECK_HEADERS([ACTION-IF-PRESENT], [ACTION-IF-ABSENT])--
359dnl Using the information found from PC_PYTHON_CHECK_INCLUDES, check
360dnl to make sure that Python.h can be loaded. Note that if you use
361dnl this, you don't strictly need to also include
362dnl PC_PYTHON_CHECK_INCLUDES.
363dnl----
364dnl
365dnl PC_PYTHON_CHECK_HEADERS(,[AC_MSG_ERROR(could not find Python headers)])
366
367
368dnl--PC_PYTHON_CHECK_LIBS----------------------------------------------
369dnl This checks what LIBS flags are necessary to use the Python
370dnl libraries (ie -lpython). The results are stored in PYTHON_LIBS
371dnl----
372dnl
373dnl PC_PYTHON_CHECK_LIBS
374
375
376dnl--PC_PYTHON_TEST_LIBS([FUNCTION-TO-TEST], [ACTION-IF-PRESENT], [ACTION-IF-ABSENT])
377dnl This checks whether the LIBS flag for libpython discovered with
378dnl PC_PYTHON_CHECK_LIBS is loadable and if a given function can be
379dnl found in the library. You may use this to test for the presence of
380dnl features in the library.
381dnl----
382dnl
383dnl PC_PYTHON_TEST_LIBS([PyObject_Print],,
384dnl [AC_MSG_ERROR(The Python library could not be loaded)])
385dnl # Add PYTHON_LIBS to LIBS
386dnl LIBS="$LIBS $PYTHON_LIBS"
387
388
389dnl--PC_PYTHON_CHECK_CFLAGS--------------------------------------------
390dnl This macro checks what Python thinks are the proper CFLAGS to
391dnl use and stores them in PYTHON_CFLAGS. Note that this info is only
392dnl available for Python versions which include a python-config tool
393dnl (2.5+).
394dnl----
395dnl
396dnl PC_PYTHON_CHECK_CFLAGS
397dnl # Add PYTHON_CFLAGS to CFLAGS
398dnl CFLAGS="$CFLAGS $PYTHON_CFLAGS"
399
400
401dnl--PC_PYTHON_CHECK_LDFLAGS-------------------------------------------
402dnl The same as above but for LDFLAGS
403dnl----
404dnl
405dnl PC_PYTHON_CHECK_LDFLAGS
406dnl # Add PYTHON_LDFLAGS to LDFLAGS
407dnl LDFLAGS="$LDFLAGS $PYTHON_LDFLAGS"
408
409
410dnl--PC_PYTHON_CHECK_EXTENSION_SUFFIX----------------------------------
411dnl This checks for what Python expects the suffix of extension
412dnl modules to be (i.e. .cpython-32mu.so) and stores it in
413dnl PYTHON_EXTENSION SUFFIX. This information is only available for
414dnl Python 3+
415dnl----
416dnl
417dnl PC_PYTHON_CHECK_EXTENSION_SUFFIX
418
419
420dnl--PC_PYTHON_CHECK_ABI_FLAGS----------------------------------------
421dnl This checks for the ABI flags used by Python (i.e. "mu") and
422dnl stores it in PYTHON_ABI_FLAGS. This information is only available
423dnl for Python 3+
424dnl----
425dnl
426dnl PC_PYTHON_CHECK_ABI_FLAGS
427
428
96f9c530 429dnl--MediaGoblin specific commands/variables ------------------------
07778a69
CAW
430
431
e342891a
BI
432dnl#########
433dnl Finish #
434dnl#########
435
436dnl Define the files to be configured
00ed01b7 437AC_CONFIG_FILES([Makefile])
07778a69 438
e342891a
BI
439dnl Generate config.status
440AC_OUTPUT