add pyconfigure stuff
[mediagoblin.git] / configure.ac
1 # Copyright 2012 Brandon Invergo <brandon@invergo.net>
2 #
3 # Copying and distribution of this file, with or without modification,
4 # are permitted in any medium without royalty provided the copyright
5 # notice and this notice are preserved. This file is offered as-is,
6 # without any warranty.
7
8 # This is a basic Autoconf configure.ac file for Python-based
9 # projects. It is not intended to be used as-is, but rather to be
10 # modified to the specific needs of the project.
11
12
13 dnl####################################
14 dnl Define some macros here as needed #
15 dnl####################################
16
17 # The minimum-required Python versions
18 m4_define(python_min_ver, 2.6)
19
20
21 dnl#############################################
22 dnl Import the Python-specific Autoconf macros #
23 dnl#############################################
24
25 # Unless these macros are included upstream somewhere, this must be included
26 m4_include([m4/python.m4])
27
28
29 dnl#######################################
30 dnl Autoconf and Automake initialization #
31 dnl#######################################
32
33 # Initialize Autoconf.
34 AC_INIT(mediagoblin, 0.3.1)
35
36 # Load macros from the m4/ directory
37 AC_CONFIG_MACRO_DIR([m4])
38 AM_INIT_AUTOMAKE
39
40 # Here we check if we are using Python 3
41 PC_PYTHON_VERIFY_VERSION([$PYTHON], 3.0,
42 py3k=true,
43 py3k=false)
44 # If using python 3, try to find python 2 instead
45 if test "$py3k" = "true" ; then
46 m4_define_default([_PYTHON2_BINS], [python2 python2.7 python2.6])
47 AC_PATH_PROGS(PYTHON, [_PYTHON2_BINS])
48 else
49 # otherwise check that the Python 2 version is sufficient
50 PC_PYTHON_VERIFY_VERSION([$PYTHON], python_min_ver, ,
51 [AC_MSG_ERROR(Python interpreter too old)])
52 fi
53
54 AC_CHECK_PROGS([SPHINXBUILD], [sphinx-build sphinx-build2], [no])
55 AS_IF([test "x$SPHINXBUILD" = xno],
56 AC_MSG_WARN(sphinx-build is required to build documentation))
57
58
59 AC_ARG_WITH([virtualenv],
60 [AS_HELP_STRING([--with-virtualenv], [install to a Python virtualenv])],
61 [],
62 [with_virtualenv=no])
63 AS_IF([test "x$with_virtualenv" != xno],
64 AC_CHECK_PROGS([VIRTUALENV], [virtualenv virtualenv2], [no])
65 AS_IF([test "x$VIRTUALENV" = xno],
66 [AC_MSG_FAILURE(
67 [--with-virtualenv given but virtualenv could not be found])]),
68 AC_SUBST([VIRTUALENV], [no]))
69 AC_ARG_VAR([VIRTUALENV_FLAGS], [flags to pass to the virtualenv command])
70
71 AC_PROG_MKDIR_P
72 AC_PROG_INSTALL
73
74 PC_PYTHON_CHECK_HEADERS(,[AC_MSG_ERROR(could not find Python headers)])
75
76 PC_PYTHON_SITE_PACKAGE_DIR
77 PC_PYTHON_EXEC_PACKAGE_DIR
78
79 PC_PYTHON_CHECK_MODULE([lxml],,[AC_MSG_ERROR(could not find Python lxml module)])
80 PC_PYTHON_CHECK_MODULE([Image],,[AC_MSG_ERROR(could not find Python Imaging Library)])
81
82
83
84 # Files to be configured
85 AC_CONFIG_FILES([Makefile])
86 # Generate config.status
87 AC_OUTPUT