File: configure.in

package info (click to toggle)
qm 2.2-4
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 3,824 kB
  • ctags: 2,276
  • sloc: python: 14,811; xml: 4,312; makefile: 119; ansic: 57; sh: 21
file content (117 lines) | stat: -rw-r--r-- 3,623 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
##################################################### -*-shell-script-*-
#
# File:   configure.in
# Author: Alex Samuel
# Date:   2001-01-09
#
# Contents:
#   Autoconf configuration for QM.
#
# Copyright (c) 2001, 2002, 2003 by CodeSourcery, LLC.  All rights reserved. 
#
# For license terms see the file COPYING.
#
########################################################################

AC_INIT(configure.in)

dnl ####################################################################
dnl Enable maintainer mode.
dnl ####################################################################

AC_ARG_ENABLE(maintainer-mode, 
              [  --enable-maintainer-mode configure for development],
              if test x${enableval} = xno; then
                MAINTAINER_MODE=0
              else
                MAINTAINER_MODE=1
              fi,
              MAINTAINER_MODE=0)
AC_SUBST(MAINTAINER_MODE)
	     
dnl ####################################################################
dnl Find the Python interpreter.  If the user specified the 
dnl --with-python option, use its value, after checking that it exists.
dnl Otherwise, look in the PATH.
dnl ####################################################################

AC_ARG_WITH(
  python, 
  [  --with-python=PATH      specify the Python interpreter],
  PYTHON="$with_python",
  PYTHON=""
)

if test -n "$PYTHON" -a "$PYTHON" != yes; then
  AC_CHECK_FILE(
    $PYTHON, 
    , 
    echo "Cannot find Python interpreter $PYTHON."; exit 1
  )
else
  AC_PATH_PROG(PYTHON, python2 python, python)
fi

dnl ####################################################################
dnl Determine the Python version.
dnl ####################################################################

# The code used to check the version only reports the version accurately
# with Python 2.0 or greater -- but the minimum acceptable version of
# Python is already higher than that.
AC_MSG_CHECKING(Python version)
cat > python-ver.py <<EOF
try:
  import sys
  print sys.version_info[[0]]
except:
  print 0
EOF
PYTHON_MAJOR=`$PYTHON python-ver.py`
cat > python-ver.py <<EOF
try:
  import sys
  print sys.version_info[[1]]
except:
  print 0
EOF
PYTHON_MINOR=`$PYTHON python-ver.py`
rm python-ver.py
PYTHON_VERSION="${PYTHON_MAJOR}.${PYTHON_MINOR}"
AC_MSG_RESULT($PYTHON_VERSION)

# Some Python versions before 2.1 have serious bugs if threads and
# fork are used together.  Therefore, Python 2.1 or higher is required.
if test "$PYTHON_MAJOR" -lt 2 || \
   (test "$PYTHON_MAJOR" -eq 2 && test "$PYTHON_MINOR" -lt 1); then
  AC_MSG_ERROR(QM requires Python version 2.1 or greater)
fi

AC_MSG_CHECKING(Python platform)
PYTHON_PLATFORM=`$PYTHON -c "import distutils.util; print distutils.util.get_platform()" 2>/dev/null`
if test $? -ne 0; then
  AC_MSG_RESULT(could not be determined)
  AC_MSG_ERROR(Python distutils module is not installed)
fi
AC_MSG_RESULT($PYTHON_PLATFORM)
AC_SUBST(PYTHON_PLATFORM)

dnl ####################################################################
dnl Look for HappyDoc, which we use to build source documentation.
dnl ####################################################################

AC_PATH_PROG(HAPPYDOC, happydoc)

# Do not try to build documentation unless --enable-maintainer-mode
# was specified.  The documentation is pre-generated for releases.
if test $MAINTAINER_MODE = 0; then
  AC_MSG_WARN(Documentation is only built with --enable-maintainer-mode.)
fi

dnl ####################################################################
dnl Generate results
dnl ####################################################################

AC_OUTPUT(
  GNUmakefile
)