File: configure.in

package info (click to toggle)
qm 1.1.3-1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 8,628 kB
  • ctags: 10,249
  • sloc: python: 41,482; ansic: 20,611; xml: 12,837; sh: 485; makefile: 226
file content (233 lines) | stat: -rw-r--r-- 7,019 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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
########################################################################
#
# File:   configure.in
# Author: Alex Samuel
# Date:   2001-01-09
#
# Contents:
#   Autoconf configuration for QM.
#
# Copyright (c) 2001, 2002 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 Set the version numbers for QM.  These values should be set here 
dnl and nowhere else in QM.
dnl ####################################################################

QM_MAJOR_VER=1
QM_MINOR_VER=1
QM_RELEASE_VER=2

AC_SUBST(QM_MAJOR_VER)
AC_SUBST(QM_MINOR_VER)
AC_SUBST(QM_RELEASE_VER)

# For a dot release, the release is named "X.Y.Z"; for other releases
# the name is just "X.Y".
if test ${QM_RELEASE_VER} -ne 0; then
    QM_VERSION=${QM_MAJOR_VER}.${QM_MINOR_VER}.${QM_RELEASE_VER}
else
    QM_VERSION=${QM_MAJOR_VER}.${QM_MINOR_VER}
fi

AC_SUBST(QM_VERSION)

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, installation prefix, and and platform.
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)
PYTHON_MAJOR=`$PYTHON <<EOF
try:
  import sys
  print sys.version_info[[0]]
except:
  print 0
EOF`
PYTHON_MINOR=`$PYTHON <<EOF
try:
  import sys
  print sys.version_info[[1]]
except:
  print 0
EOF`
PYTHON_VERSION="${PYTHON_MAJOR}.${PYTHON_MINOR}"
AC_MSG_RESULT($PYTHON_VERSION)
AC_SUBST(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 prefix)
PYTHON_PREFIX=`$PYTHON -c "import sys; print sys.prefix"`
AC_MSG_RESULT($PYTHON_PREFIX)
AC_SUBST(PYTHON_PREFIX)

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, no)

dnl ####################################################################
dnl Jade and Tidy are used to generate documentation.  Without Jade,
dnl documentation will not be built.
dnl ####################################################################

AC_PATH_PROG(JADE, jade, no)
AC_PATH_PROG(TIDY, tidy, no)

dnl ####################################################################
dnl We need XML declarations for Jade, in xml.dcl.  This file should be 
dnl included with Jade.  Look for it in some usual places.
dnl ####################################################################

if test "$JADE" != no; then
  AC_MSG_CHECKING(xml.dcl)
  XML_DCL=no
  for file in \
    /usr/share/doc/jade*/pubtext/xml.dcl \
    /usr/share/doc/openjade*/pubtext/xml.dcl \
    /usr/doc/jade*/pubtext/xml.dcl \
    /usr/share/sgml/declaration/xml.dcl \
  ; do
    if test -r "$file"; then
      XML_DCL=$file
      break
    fi
  done
  AC_MSG_RESULT($XML_DCL)
  AC_SUBST(XML_DCL)
fi

dnl ####################################################################
dnl To build documentation, we need DSSSL stylesheets for DocBook.  Look
dnl for them in some usual places.
dnl ####################################################################

AC_MSG_CHECKING(DocBook stylesheets)
DOCBOOK_STYLESHEETS=no
for dir in \
  /usr/lib/sgml/stylesheets/docbook \
  /usr/lib/sgml/stylesheet/dsssl/docbook \
; do
  if test -d $dir; then
    DOCBOOK_STYLESHEETS=$dir
    break
  fi
done
AC_MSG_RESULT($DOCBOOK_STYLESHEETS)
AC_SUBST(DOCBOOK_STYLESHEETS)

dnl #####################
dnl Find the Docbook DTD.
dnl #####################

DOCBOOK_DTD=
AC_MSG_CHECKING(for docbook DTD)
AC_ARG_WITH(docbook-dtd, 
            [  --with-docbook-dtd=PATH directory containing the docbook DTD.],
            [case $withval in
               yes) DOCBOOK_DTD=/usr/lib/sgml;;
               no)  ;;
               *)   DOCBOOK_DTD=$withval;;
             esac],
            DOCBOOK_DTD=/usr/lib/sgml)
AC_MSG_RESULT($DOCBOOK_DTD)
AC_SUBST(DOCBOOK_DTD)

if test "$JADE" = no -o "$XML_DCL" = no -o "$DOCBOOK_DTD" = no; then
  AC_MSG_WARN(Documentation will not be built.)
  DOCUMENTATION=no
else
  DOCUMENTATION=yes
fi

# Do not try to build documentation unless --enable-maintainer-mode
# was specified.  The documentation is pre-generated for releases.

if test $DOCUMENTATION = yes && test $MAINTAINER_MODE = 0; then
  AC_MSG_WARN(Documentation is only built in maintainer mode.)
  DOCUMENTATION=no
fi

AC_SUBST(DOCUMENTATION)

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

AC_OUTPUT(
  GNUmakefile
  qm.spec
  qm/setup_path.py
)

dnl ####################################################################
dnl This follows the setup instructions in the Gadfly package.  The
dnl target is a file generated in the setup procedure.  See
dnl gadfly/index.html.
dnl ####################################################################

if test -d gadfly; then
  cd gadfly && $PYTHON gfinstall.py
fi