- need self.metadata with BaseProcessingFail
[mediagoblin.git] / configure.ac
CommitLineData
e342891a
BI
1dnl configure.ac
2dnl
3dnl Copyright 2012, 2013 Brandon Invergo <brandon@invergo.net>
4dnl
5dnl Copying and distribution of this file, with or without modification,
6dnl are permitted in any medium without royalty provided the copyright
7dnl notice and this notice are preserved. This file is offered as-is,
8dnl without any warranty.
9
10dnl#########
11dnl README #
12dnl#########
13dnl
14dnl This is a basic Autoconf configure.ac file for Python-based
15dnl projects. It is not intended to be used as-is, but rather to be
16dnl modified to the specific needs of the project.
17dnl
18dnl Lines prefixed with "dnl" are comments that are automatically
19dnl removed by Autoconf/M4, thus they will not appear in the generated
20dnl configure script (see the M4 documentation for more information).
21dnl Such comments are used in this file to communicate information to
22dnl you, the developer. In some cases, the comments contain extra
23dnl macros that you might consider including in your configure script.
24dnl If you wish to include them, simply remove the "dnl" from the
25dnl beginning of the line.
26dnl
27dnl Lines prefixed with "#" are comments that will appear in the
28dnl generated configure script. These comments are thus used to clarify
29dnl to the user what is happening in that script
30dnl
31dnl Wherever pyconfigure-specific macros are used, extra comments are
32dnl included to describe the macros.
33
34dnl######################
35dnl Package Information #
36dnl######################
37
38dnl----
39dnl Initialize Autoconf with the package metadata
40dnl The arguments have been set via the project's PKG-INFO file
41dnl and correspond to:
42dnl
43dnl 1) package name (i.e. foo)
44dnl 2) package version (i.e. 1.2)
45dnl 3) bug/info/project email address (i.e. bug-foo@gnu.org)
46dnl----
47dnl
48AC_INIT([mediagoblin], [0.4.0.dev], [cwebber@gnu.org])
49
50dnl----
51dnl Load macros from the m4/ directory. If you plan to write new
52dnl macros, put them in files in this directory.
53dnl----
54dnl
55AC_CONFIG_MACRO_DIR([m4])
56
57
dc85ee8c
BI
58# The default prefix should be changed from /usr/local. Set it, as in
59# the documentation, to /srv/mediagoblin.example.org/mediagoblin/
e56b493a 60AC_PREFIX_DEFAULT([`pwd`])
dc85ee8c
BI
61
62
e342891a
BI
63dnl###########################
64dnl Program/command support #
65dnl###########################
66dnl
67dnl In this section, we check for the presence of important commands
68dnl and programs.
69
70dnl--PC_INIT----------------------------------------------------------
71dnl This is the only required macro. Its primary function is to find
72dnl a Python interpreter that is compatible with the package and set
73dnl the PYTHON variable to hold its path. It can optionally take
74dnl arguments to specify minimum and/or maximum versions:
75dnl PC_INIT: find an interpreter with a version between 2.0 and 3.3.99
76dnl (in other words, up to and including any possible release
77dnl in the 3.3 series)
78dnl PC_INIT([MIN_VER], [MAX_VER]): Find an interpreter that is between
79dnl the minimum and maximum version. If the min is in the 2.0
80dnl series and the max is in the 3.0 series, non-existent
81dnl releases (2.8 & 2.9) will be correctly skipped.
82dnl----
83dnl
84PC_INIT([2.6], [2.7.99])
85
86dnl--PC_PYTHON_PROG_PYTHON_CONFIG-------------------------------------
87dnl In order to use some of the other macros, you also need the
88dnl python-config command, which will fall subject to the same problem
89dnl of python3-config being preferred to python2-config. This macro
90dnl will be automatically included if you use on of the macros that
91dnl depends on it, so you normally don't have to call it. However, if
92dnl you require a specific version, you can do something like the
93dnl following example.
94dnl----
95dnl
96PC_PYTHON_PROG_PYTHON_CONFIG([python2-config])
97if [[ "x$PYTHON_CONFIG" == "x" ]]; then
98 PC_PYTHON_PROG_PYTHON_CONFIG([$PYTHON-config])
99fi
100
101dnl----
102dnl With the following set of macros, we implement an option
103dnl "--with-virtualenv", which the user can pass to the configure
104dnl script in order to install to a Virtualenv (AC_ARG_WITH). If the
105dnl option is specified by the user, then we check if the program is
106dnl available, checking both for "virtualenv" and "virtualenv2"
107dnl (AC_CHECK_PROGS)
108dnl----
109dnl
110# Support installing to a virtualenv via the --with-virtualenv
111# configure flag
112AC_ARG_WITH([virtualenv],
20f7fd5d 113 [AS_HELP_STRING([--without-virtualenv], [install to a Python virtualenv])],
e342891a 114 [],
20f7fd5d 115 [with_virtualenv=yes])
e342891a
BI
116AS_IF([test "x$with_virtualenv" != xno],
117 AC_CHECK_PROGS([VIRTUALENV], [virtualenv virtualenv3 virtualenv2], [no])
118 AS_IF([test "x$VIRTUALENV" = xno],
119 [AC_MSG_FAILURE(
120 [--with-virtualenv given but virtualenv could not be found])]),
121 AC_SUBST([VIRTUALENV], [no]))
122AC_ARG_VAR([VIRTUALENV_FLAGS], [flags to pass to the virtualenv command])
123
124dnl----
125dnl If the program uses sphinx-build to build documentation, uncomment
126dnl this to create a SPHINXBUILD variable in the Makefile pointing to
127dnl the program. Thus, the user would specify
128dnl SPHINXBUILD=/path/to/sphinx-build as an argument to the configure
129dnl script. Since building the documentation should be optional, just
130dnl print a warning. If the program uses some other documentation
131dnl system, you can do something similar with it.
132dnl----
133dnl
134# Check for sphinx-build
135AC_CHECK_PROGS([SPHINXBUILD], [sphinx-build sphinx-build3 sphinx-build2], [no])
136AS_IF([test "x$SPHINXBUILD" = xno],
137 AC_MSG_WARN(sphinx-build is required to build documentation))
138
139
140dnl----
141dnl These two are standard Autoconf macros which check for the
142dnl presence of some programs that we will use in the Makefile.
143dnl----
144dnl
145AC_PROG_MKDIR_P
146AC_PROG_INSTALL
147
148# Check for a supported database program
149AC_PATH_PROG([SQLITE], [sqlite3])
150AC_PATH_PROG([POSTGRES], [postgres])
f16f93be
BI
151AS_IF([test "x$SQLITE" = x -a "x$POSTGRES" = "x"],
152 [AC_MSG_ERROR([SQLite or PostgreSQL is required])])
153
e342891a
BI
154
155dnl--PC_PYTHON_SITE_PACKAGE_DIR---------------------------------------
156dnl This uses PYTHON_SITE_DIR to construct a directory for this
157dnl project (ie $PYTHON_SITE_DIR/project_name) and stores it in
158dnl pkgpythondir. This value is used by Automake for installing Python
159dnl scripts. By default, this begins with $pythondir, unexpanded, to
160dnl provide compatibility with GNU Makefile specifications, allowing
161dnl the user to change the prefix from the commandline.
162dnl----
163dnl
164PC_PYTHON_SITE_PACKAGE_DIR
165
166dnl--PC_PYTHON_EXEC_PACKAGE_DIR----------------------------------------
167dnl Same as PC_PYTHON_SITE_PACKAGE_DIR but for $exec-prefix. Stored in
168dnl pkgpyexecdir
169dnl----
170dnl
171PC_PYTHON_EXEC_PACKAGE_DIR
172
173
174dnl###############################
175dnl Checking Python capabilities #
176dnl###############################
177
178dnl--PC_PYTHON_CHECK_MODULE([PYTHON-MODULE], [ACTION-IF-PRESENT],
179dnl [ACTION-IF-ABSENT])
180dnl This macro lets you check if a given Python module exists on the
181dnl system.
182dnl----
183dnl
184dnl PC_PYTHON_CHECK_MODULE([foo])
185
186# Check for python-lxml module
187PC_PYTHON_CHECK_MODULE([lxml], [],
188 [AC_MSG_ERROR([python-lxml is required])])
189
190# Check for the Python Imaging Library
191PC_PYTHON_CHECK_MODULE([Image], [],
192 [AC_MSG_ERROR([Python Imaging Library is required])])
193
194
195dnl#########
196dnl Finish #
197dnl#########
198
199dnl Define the files to be configured
00ed01b7 200AC_CONFIG_FILES([Makefile])
e342891a
BI
201dnl Generate config.status
202AC_OUTPUT