From ef513974abdd60284b4c32371acbe9ee0eb9c019 Mon Sep 17 00:00:00 2001 From: Brandon Invergo Date: Mon, 12 Nov 2012 23:31:14 +0100 Subject: add pyconfigure stuff --- configure.ac | 87 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 configure.ac (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac new file mode 100644 index 00000000..91dd5891 --- /dev/null +++ b/configure.ac @@ -0,0 +1,87 @@ +# Copyright 2012 Brandon Invergo +# +# Copying and distribution of this file, with or without modification, +# are permitted in any medium without royalty provided the copyright +# notice and this notice are preserved. This file is offered as-is, +# without any warranty. + +# This is a basic Autoconf configure.ac file for Python-based +# projects. It is not intended to be used as-is, but rather to be +# modified to the specific needs of the project. + + +dnl#################################### +dnl Define some macros here as needed # +dnl#################################### + +# The minimum-required Python versions +m4_define(python_min_ver, 2.6) + + +dnl############################################# +dnl Import the Python-specific Autoconf macros # +dnl############################################# + +# Unless these macros are included upstream somewhere, this must be included +m4_include([m4/python.m4]) + + +dnl####################################### +dnl Autoconf and Automake initialization # +dnl####################################### + +# Initialize Autoconf. +AC_INIT(mediagoblin, 0.3.1) + +# Load macros from the m4/ directory +AC_CONFIG_MACRO_DIR([m4]) +AM_INIT_AUTOMAKE + +# Here we check if we are using Python 3 +PC_PYTHON_VERIFY_VERSION([$PYTHON], 3.0, + py3k=true, + py3k=false) +# If using python 3, try to find python 2 instead +if test "$py3k" = "true" ; then + m4_define_default([_PYTHON2_BINS], [python2 python2.7 python2.6]) + AC_PATH_PROGS(PYTHON, [_PYTHON2_BINS]) +else +# otherwise check that the Python 2 version is sufficient + PC_PYTHON_VERIFY_VERSION([$PYTHON], python_min_ver, , + [AC_MSG_ERROR(Python interpreter too old)]) +fi + +AC_CHECK_PROGS([SPHINXBUILD], [sphinx-build sphinx-build2], [no]) +AS_IF([test "x$SPHINXBUILD" = xno], + AC_MSG_WARN(sphinx-build is required to build documentation)) + + +AC_ARG_WITH([virtualenv], + [AS_HELP_STRING([--with-virtualenv], [install to a Python virtualenv])], + [], + [with_virtualenv=no]) +AS_IF([test "x$with_virtualenv" != xno], + AC_CHECK_PROGS([VIRTUALENV], [virtualenv virtualenv2], [no]) + AS_IF([test "x$VIRTUALENV" = xno], + [AC_MSG_FAILURE( + [--with-virtualenv given but virtualenv could not be found])]), + AC_SUBST([VIRTUALENV], [no])) +AC_ARG_VAR([VIRTUALENV_FLAGS], [flags to pass to the virtualenv command]) + +AC_PROG_MKDIR_P +AC_PROG_INSTALL + +PC_PYTHON_CHECK_HEADERS(,[AC_MSG_ERROR(could not find Python headers)]) + +PC_PYTHON_SITE_PACKAGE_DIR +PC_PYTHON_EXEC_PACKAGE_DIR + +PC_PYTHON_CHECK_MODULE([lxml],,[AC_MSG_ERROR(could not find Python lxml module)]) +PC_PYTHON_CHECK_MODULE([Image],,[AC_MSG_ERROR(could not find Python Imaging Library)]) + + + +# Files to be configured +AC_CONFIG_FILES([Makefile]) +# Generate config.status +AC_OUTPUT -- cgit v1.2.3 From 60c42337ef7bc9b4aec0d3f1b2cb5f19a09d9a7f Mon Sep 17 00:00:00 2001 From: Brandon Invergo Date: Sun, 19 May 2013 13:22:39 +0200 Subject: clean up --- configure.ac | 87 ------------------------------------------------------------ 1 file changed, 87 deletions(-) delete mode 100644 configure.ac (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac deleted file mode 100644 index 91dd5891..00000000 --- a/configure.ac +++ /dev/null @@ -1,87 +0,0 @@ -# Copyright 2012 Brandon Invergo -# -# Copying and distribution of this file, with or without modification, -# are permitted in any medium without royalty provided the copyright -# notice and this notice are preserved. This file is offered as-is, -# without any warranty. - -# This is a basic Autoconf configure.ac file for Python-based -# projects. It is not intended to be used as-is, but rather to be -# modified to the specific needs of the project. - - -dnl#################################### -dnl Define some macros here as needed # -dnl#################################### - -# The minimum-required Python versions -m4_define(python_min_ver, 2.6) - - -dnl############################################# -dnl Import the Python-specific Autoconf macros # -dnl############################################# - -# Unless these macros are included upstream somewhere, this must be included -m4_include([m4/python.m4]) - - -dnl####################################### -dnl Autoconf and Automake initialization # -dnl####################################### - -# Initialize Autoconf. -AC_INIT(mediagoblin, 0.3.1) - -# Load macros from the m4/ directory -AC_CONFIG_MACRO_DIR([m4]) -AM_INIT_AUTOMAKE - -# Here we check if we are using Python 3 -PC_PYTHON_VERIFY_VERSION([$PYTHON], 3.0, - py3k=true, - py3k=false) -# If using python 3, try to find python 2 instead -if test "$py3k" = "true" ; then - m4_define_default([_PYTHON2_BINS], [python2 python2.7 python2.6]) - AC_PATH_PROGS(PYTHON, [_PYTHON2_BINS]) -else -# otherwise check that the Python 2 version is sufficient - PC_PYTHON_VERIFY_VERSION([$PYTHON], python_min_ver, , - [AC_MSG_ERROR(Python interpreter too old)]) -fi - -AC_CHECK_PROGS([SPHINXBUILD], [sphinx-build sphinx-build2], [no]) -AS_IF([test "x$SPHINXBUILD" = xno], - AC_MSG_WARN(sphinx-build is required to build documentation)) - - -AC_ARG_WITH([virtualenv], - [AS_HELP_STRING([--with-virtualenv], [install to a Python virtualenv])], - [], - [with_virtualenv=no]) -AS_IF([test "x$with_virtualenv" != xno], - AC_CHECK_PROGS([VIRTUALENV], [virtualenv virtualenv2], [no]) - AS_IF([test "x$VIRTUALENV" = xno], - [AC_MSG_FAILURE( - [--with-virtualenv given but virtualenv could not be found])]), - AC_SUBST([VIRTUALENV], [no])) -AC_ARG_VAR([VIRTUALENV_FLAGS], [flags to pass to the virtualenv command]) - -AC_PROG_MKDIR_P -AC_PROG_INSTALL - -PC_PYTHON_CHECK_HEADERS(,[AC_MSG_ERROR(could not find Python headers)]) - -PC_PYTHON_SITE_PACKAGE_DIR -PC_PYTHON_EXEC_PACKAGE_DIR - -PC_PYTHON_CHECK_MODULE([lxml],,[AC_MSG_ERROR(could not find Python lxml module)]) -PC_PYTHON_CHECK_MODULE([Image],,[AC_MSG_ERROR(could not find Python Imaging Library)]) - - - -# Files to be configured -AC_CONFIG_FILES([Makefile]) -# Generate config.status -AC_OUTPUT -- cgit v1.2.3 From e342891a5db0257107f9659157c35c92b583e593 Mon Sep 17 00:00:00 2001 From: Brandon Invergo Date: Sun, 19 May 2013 13:55:01 +0200 Subject: add configure.ac --- configure.ac | 197 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 197 insertions(+) create mode 100644 configure.ac (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac new file mode 100644 index 00000000..874bf60a --- /dev/null +++ b/configure.ac @@ -0,0 +1,197 @@ +dnl configure.ac +dnl +dnl Copyright 2012, 2013 Brandon Invergo +dnl +dnl Copying and distribution of this file, with or without modification, +dnl are permitted in any medium without royalty provided the copyright +dnl notice and this notice are preserved. This file is offered as-is, +dnl without any warranty. + +dnl######### +dnl README # +dnl######### +dnl +dnl This is a basic Autoconf configure.ac file for Python-based +dnl projects. It is not intended to be used as-is, but rather to be +dnl modified to the specific needs of the project. +dnl +dnl Lines prefixed with "dnl" are comments that are automatically +dnl removed by Autoconf/M4, thus they will not appear in the generated +dnl configure script (see the M4 documentation for more information). +dnl Such comments are used in this file to communicate information to +dnl you, the developer. In some cases, the comments contain extra +dnl macros that you might consider including in your configure script. +dnl If you wish to include them, simply remove the "dnl" from the +dnl beginning of the line. +dnl +dnl Lines prefixed with "#" are comments that will appear in the +dnl generated configure script. These comments are thus used to clarify +dnl to the user what is happening in that script +dnl +dnl Wherever pyconfigure-specific macros are used, extra comments are +dnl included to describe the macros. + +dnl###################### +dnl Package Information # +dnl###################### + +dnl---- +dnl Initialize Autoconf with the package metadata +dnl The arguments have been set via the project's PKG-INFO file +dnl and correspond to: +dnl +dnl 1) package name (i.e. foo) +dnl 2) package version (i.e. 1.2) +dnl 3) bug/info/project email address (i.e. bug-foo@gnu.org) +dnl---- +dnl +AC_INIT([mediagoblin], [0.4.0.dev], [cwebber@gnu.org]) + +dnl---- +dnl Load macros from the m4/ directory. If you plan to write new +dnl macros, put them in files in this directory. +dnl---- +dnl +AC_CONFIG_MACRO_DIR([m4]) + + +dnl########################### +dnl Program/command support # +dnl########################### +dnl +dnl In this section, we check for the presence of important commands +dnl and programs. + +dnl--PC_INIT---------------------------------------------------------- +dnl This is the only required macro. Its primary function is to find +dnl a Python interpreter that is compatible with the package and set +dnl the PYTHON variable to hold its path. It can optionally take +dnl arguments to specify minimum and/or maximum versions: +dnl PC_INIT: find an interpreter with a version between 2.0 and 3.3.99 +dnl (in other words, up to and including any possible release +dnl in the 3.3 series) +dnl PC_INIT([MIN_VER], [MAX_VER]): Find an interpreter that is between +dnl the minimum and maximum version. If the min is in the 2.0 +dnl series and the max is in the 3.0 series, non-existent +dnl releases (2.8 & 2.9) will be correctly skipped. +dnl---- +dnl +PC_INIT([2.6], [2.7.99]) + +dnl--PC_PYTHON_PROG_PYTHON_CONFIG------------------------------------- +dnl In order to use some of the other macros, you also need the +dnl python-config command, which will fall subject to the same problem +dnl of python3-config being preferred to python2-config. This macro +dnl will be automatically included if you use on of the macros that +dnl depends on it, so you normally don't have to call it. However, if +dnl you require a specific version, you can do something like the +dnl following example. +dnl---- +dnl +PC_PYTHON_PROG_PYTHON_CONFIG([python2-config]) +if [[ "x$PYTHON_CONFIG" == "x" ]]; then + PC_PYTHON_PROG_PYTHON_CONFIG([$PYTHON-config]) +fi + +dnl---- +dnl With the following set of macros, we implement an option +dnl "--with-virtualenv", which the user can pass to the configure +dnl script in order to install to a Virtualenv (AC_ARG_WITH). If the +dnl option is specified by the user, then we check if the program is +dnl available, checking both for "virtualenv" and "virtualenv2" +dnl (AC_CHECK_PROGS) +dnl---- +dnl +# Support installing to a virtualenv via the --with-virtualenv +# configure flag +AC_ARG_WITH([virtualenv], + [AS_HELP_STRING([--with-virtualenv], [install to a Python virtualenv])], + [], + [with_virtualenv=no]) +AS_IF([test "x$with_virtualenv" != xno], + AC_CHECK_PROGS([VIRTUALENV], [virtualenv virtualenv3 virtualenv2], [no]) + AS_IF([test "x$VIRTUALENV" = xno], + [AC_MSG_FAILURE( + [--with-virtualenv given but virtualenv could not be found])]), + AC_SUBST([VIRTUALENV], [no])) +AC_ARG_VAR([VIRTUALENV_FLAGS], [flags to pass to the virtualenv command]) + +dnl---- +dnl If the program uses sphinx-build to build documentation, uncomment +dnl this to create a SPHINXBUILD variable in the Makefile pointing to +dnl the program. Thus, the user would specify +dnl SPHINXBUILD=/path/to/sphinx-build as an argument to the configure +dnl script. Since building the documentation should be optional, just +dnl print a warning. If the program uses some other documentation +dnl system, you can do something similar with it. +dnl---- +dnl +# Check for sphinx-build +AC_CHECK_PROGS([SPHINXBUILD], [sphinx-build sphinx-build3 sphinx-build2], [no]) +AS_IF([test "x$SPHINXBUILD" = xno], + AC_MSG_WARN(sphinx-build is required to build documentation)) + + +dnl---- +dnl These two are standard Autoconf macros which check for the +dnl presence of some programs that we will use in the Makefile. +dnl---- +dnl +AC_PROG_MKDIR_P +AC_PROG_INSTALL + +# Check for a supported database program +AC_PATH_PROG([SQLITE], [sqlite3]) +AC_PATH_PROG([POSTGRES], [postgres]) +if [[ "x$SQLITE" = "x" && "x$POSTGRES" = "x" ]]; then + AC_MSG_ERROR([SQLite or PostgreSQL is required]) +fi + +dnl--PC_PYTHON_SITE_PACKAGE_DIR--------------------------------------- +dnl This uses PYTHON_SITE_DIR to construct a directory for this +dnl project (ie $PYTHON_SITE_DIR/project_name) and stores it in +dnl pkgpythondir. This value is used by Automake for installing Python +dnl scripts. By default, this begins with $pythondir, unexpanded, to +dnl provide compatibility with GNU Makefile specifications, allowing +dnl the user to change the prefix from the commandline. +dnl---- +dnl +PC_PYTHON_SITE_PACKAGE_DIR + +dnl--PC_PYTHON_EXEC_PACKAGE_DIR---------------------------------------- +dnl Same as PC_PYTHON_SITE_PACKAGE_DIR but for $exec-prefix. Stored in +dnl pkgpyexecdir +dnl---- +dnl +PC_PYTHON_EXEC_PACKAGE_DIR + + +dnl############################### +dnl Checking Python capabilities # +dnl############################### + +dnl--PC_PYTHON_CHECK_MODULE([PYTHON-MODULE], [ACTION-IF-PRESENT], +dnl [ACTION-IF-ABSENT]) +dnl This macro lets you check if a given Python module exists on the +dnl system. +dnl---- +dnl +dnl PC_PYTHON_CHECK_MODULE([foo]) + +# Check for python-lxml module +PC_PYTHON_CHECK_MODULE([lxml], [], + [AC_MSG_ERROR([python-lxml is required])]) + +# Check for the Python Imaging Library +PC_PYTHON_CHECK_MODULE([Image], [], + [AC_MSG_ERROR([Python Imaging Library is required])]) + + +dnl######### +dnl Finish # +dnl######### + +dnl Define the files to be configured +AC_CONFIG_FILES([Makefile setup.py]) +dnl Generate config.status +AC_OUTPUT -- cgit v1.2.3 From f16f93be3fd8d6e09074bbf8a3f38ac10dad23d4 Mon Sep 17 00:00:00 2001 From: Brandon Invergo Date: Sun, 19 May 2013 15:16:37 +0200 Subject: fix testing for db program --- configure.ac | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac index 874bf60a..6b423151 100644 --- a/configure.ac +++ b/configure.ac @@ -143,9 +143,9 @@ AC_PROG_INSTALL # Check for a supported database program AC_PATH_PROG([SQLITE], [sqlite3]) AC_PATH_PROG([POSTGRES], [postgres]) -if [[ "x$SQLITE" = "x" && "x$POSTGRES" = "x" ]]; then - AC_MSG_ERROR([SQLite or PostgreSQL is required]) -fi +AS_IF([test "x$SQLITE" = x -a "x$POSTGRES" = "x"], + [AC_MSG_ERROR([SQLite or PostgreSQL is required])]) + dnl--PC_PYTHON_SITE_PACKAGE_DIR--------------------------------------- dnl This uses PYTHON_SITE_DIR to construct a directory for this -- cgit v1.2.3 From dc85ee8cef5c7eaef9b578e5db266642ce070f71 Mon Sep 17 00:00:00 2001 From: Brandon Invergo Date: Sun, 19 May 2013 15:30:18 +0200 Subject: change default prefix --- configure.ac | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac index 6b423151..345a5a86 100644 --- a/configure.ac +++ b/configure.ac @@ -55,6 +55,11 @@ dnl AC_CONFIG_MACRO_DIR([m4]) +# The default prefix should be changed from /usr/local. Set it, as in +# the documentation, to /srv/mediagoblin.example.org/mediagoblin/ +AC_PREFIX_DEFAULT([/srv/mediagoblin.example.org/mediagoblin/]) + + dnl########################### dnl Program/command support # dnl########################### -- cgit v1.2.3 From e56b493a9e3846672fb1b0927ec354b1a8d9a3a2 Mon Sep 17 00:00:00 2001 From: Brandon Invergo Date: Sun, 19 May 2013 23:42:04 +0200 Subject: fix aux file installation --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac index 345a5a86..7fedb6b7 100644 --- a/configure.ac +++ b/configure.ac @@ -57,7 +57,7 @@ AC_CONFIG_MACRO_DIR([m4]) # The default prefix should be changed from /usr/local. Set it, as in # the documentation, to /srv/mediagoblin.example.org/mediagoblin/ -AC_PREFIX_DEFAULT([/srv/mediagoblin.example.org/mediagoblin/]) +AC_PREFIX_DEFAULT([`pwd`]) dnl########################### -- cgit v1.2.3 From 20f7fd5d0bcdbc22009f8b6a783e7550011976d4 Mon Sep 17 00:00:00 2001 From: Brandon Invergo Date: Mon, 20 May 2013 00:02:50 +0200 Subject: make virtualenv use the default --- configure.ac | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac index 7fedb6b7..3a6a802f 100644 --- a/configure.ac +++ b/configure.ac @@ -110,9 +110,9 @@ dnl # Support installing to a virtualenv via the --with-virtualenv # configure flag AC_ARG_WITH([virtualenv], - [AS_HELP_STRING([--with-virtualenv], [install to a Python virtualenv])], + [AS_HELP_STRING([--without-virtualenv], [install to a Python virtualenv])], [], - [with_virtualenv=no]) + [with_virtualenv=yes]) AS_IF([test "x$with_virtualenv" != xno], AC_CHECK_PROGS([VIRTUALENV], [virtualenv virtualenv3 virtualenv2], [no]) AS_IF([test "x$VIRTUALENV" = xno], -- cgit v1.2.3 From 00ed01b7cb78a5c95f2d71780cad85ac44482a1e Mon Sep 17 00:00:00 2001 From: Christopher Allan Webber Date: Thu, 25 Jul 2013 14:34:48 -0500 Subject: Moving setup.py.in back to setup.py --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac index 3a6a802f..e56a55a5 100644 --- a/configure.ac +++ b/configure.ac @@ -197,6 +197,6 @@ dnl Finish # dnl######### dnl Define the files to be configured -AC_CONFIG_FILES([Makefile setup.py]) +AC_CONFIG_FILES([Makefile]) dnl Generate config.status AC_OUTPUT -- cgit v1.2.3 From 26da3271f6e6a880c0418998d5a4e5e71081e1f7 Mon Sep 17 00:00:00 2001 From: Rodney Ewing Date: Tue, 20 Aug 2013 07:03:55 -0700 Subject: This patch checks for libs instead of programs in configure.ac for sqlite3 and postgesql. Patch submitted by amirouche --- configure.ac | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac index e56a55a5..95930639 100644 --- a/configure.ac +++ b/configure.ac @@ -144,13 +144,16 @@ dnl---- dnl AC_PROG_MKDIR_P AC_PROG_INSTALL +AC_CHECK_PROG(HAVE_PKG_CONFIG, pkg-config, yes) +AS_IF([test "x$HAVE_PKG_CONFIG" = "x"], + [AC_MSG_ERROR([you need pkg-config])]) # Check for a supported database program -AC_PATH_PROG([SQLITE], [sqlite3]) -AC_PATH_PROG([POSTGRES], [postgres]) -AS_IF([test "x$SQLITE" = x -a "x$POSTGRES" = "x"], - [AC_MSG_ERROR([SQLite or PostgreSQL is required])]) +PKG_CHECK_EXISTS([sqlite3], HAVE_SQLITE3="yes") +PKG_CHECK_EXISTS([pq], HAVE_PQ="yes") +AS_IF([test "x$HAVE_SQLITE3" = "x" -a "x$HAVE_PQ" = "x"], + [AC_MSG_ERROR([SQLite or PostgreSQL is required])]) dnl--PC_PYTHON_SITE_PACKAGE_DIR--------------------------------------- dnl This uses PYTHON_SITE_DIR to construct a directory for this -- cgit v1.2.3 From c62d174437445565b55b220396e7571a323a159c Mon Sep 17 00:00:00 2001 From: Rodney Ewing Date: Tue, 20 Aug 2013 07:52:12 -0700 Subject: Oops, this accidently slipped in there Revert "This patch checks for libs instead of programs in configure.ac for sqlite3 and postgesql." This reverts commit 26da3271f6e6a880c0418998d5a4e5e71081e1f7. --- configure.ac | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac index 95930639..e56a55a5 100644 --- a/configure.ac +++ b/configure.ac @@ -144,17 +144,14 @@ dnl---- dnl AC_PROG_MKDIR_P AC_PROG_INSTALL -AC_CHECK_PROG(HAVE_PKG_CONFIG, pkg-config, yes) -AS_IF([test "x$HAVE_PKG_CONFIG" = "x"], - [AC_MSG_ERROR([you need pkg-config])]) # Check for a supported database program -PKG_CHECK_EXISTS([sqlite3], HAVE_SQLITE3="yes") -PKG_CHECK_EXISTS([pq], HAVE_PQ="yes") - -AS_IF([test "x$HAVE_SQLITE3" = "x" -a "x$HAVE_PQ" = "x"], +AC_PATH_PROG([SQLITE], [sqlite3]) +AC_PATH_PROG([POSTGRES], [postgres]) +AS_IF([test "x$SQLITE" = x -a "x$POSTGRES" = "x"], [AC_MSG_ERROR([SQLite or PostgreSQL is required])]) + dnl--PC_PYTHON_SITE_PACKAGE_DIR--------------------------------------- dnl This uses PYTHON_SITE_DIR to construct a directory for this dnl project (ie $PYTHON_SITE_DIR/project_name) and stores it in -- cgit v1.2.3