~ubuntu-branches/ubuntu/trusty/reinteract/trusty

« back to all changes in this revision

Viewing changes to configure.ac

  • Committer: Bazaar Package Importer
  • Author(s): Chris Lamb
  • Date: 2009-03-28 00:53:14 UTC
  • Revision ID: james.westby@ubuntu.com-20090328005314-ramzoo0q6r8rmwuc
Tags: upstream-0.5.0
ImportĀ upstreamĀ versionĀ 0.5.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
AC_INIT(reinteract, 0.5.0)
 
2
 
 
3
AC_CONFIG_AUX_DIR(config)
 
4
 
 
5
AM_INIT_AUTOMAKE([dist-bzip2 no-dist-gzip])
 
6
AM_MAINTAINER_MODE
 
7
AM_PATH_PYTHON(2.4)
 
8
 
 
9
AC_CONFIG_HEADERS(config.h)
 
10
 
 
11
AC_PROG_CC
 
12
AC_PROG_OBJC
 
13
 
 
14
changequote(,)dnl
 
15
if test "x$GCC" = "xyes"; then
 
16
  case " $CFLAGS " in
 
17
  *[\ \ ]-Wall[\ \      ]*) ;;
 
18
  *) CFLAGS="$CFLAGS -Wall" ;;
 
19
  esac
 
20
 
 
21
  case " $OBJCFLAGS " in
 
22
  *[\ \ ]-Wall[\ \      ]*) ;;
 
23
  *) OBJCFLAGS="$OBJCFLAGS -Wall" ;;
 
24
  esac
 
25
fi
 
26
changequote([,])dnl
 
27
 
 
28
APPDIR=
 
29
AC_ARG_WITH(appdir,
 
30
            [AC_HELP_STRING([--with-appdir=APPDIR],
 
31
                 [On OS X, install Reinteract.app into APPDIR])],
 
32
            [if test x$withval = xyes ; then
 
33
                AC_MSG_ERROR([Directory must be specified as argument to --with-appdir])
 
34
             elif test x$withval = xno ; then
 
35
                :
 
36
             else
 
37
                APPDIR=$withval
 
38
             fi])
 
39
 
 
40
AM_CONDITIONAL(INSTALL_APP, test "x$APPDIR" != x)
 
41
AC_SUBST(APPDIR)
 
42
 
 
43
use_python_thunks=false
 
44
AC_ARG_ENABLE(python-thunks,
 
45
              [AC_HELP_STRING([--enable-python-thunks],
 
46
                 [On OS X, lazily locate Python at run-time (default is no)])],
 
47
              [if test "x$enableval" != xno ; then use_python_thunks=true ; fi])
 
48
 
 
49
if $use_python_thunks ; then
 
50
   AC_DEFINE(USE_PYTHON_THUNKS, 1,
 
51
             [Define to locate Python lazily at runtime])
 
52
fi
 
53
 
 
54
AM_CONDITIONAL(USE_PYTHON_THUNKS, $use_python_thunks)
 
55
 
 
56
dnl A macro to get a variable from distutils.sysconfig
 
57
dnl reinteract_GET_CONFIG_VAR(SHELL_NAME, SYSCONFIG_NAME)
 
58
dnl
 
59
AC_DEFUN([reinteract_GET_CONFIG_VAR],
 
60
    [$1=`$PYTHON -c "import sys; import distutils.sysconfig; sys.stdout.write(distutils.sysconfig.get_config_var('$2'))"`])
 
61
 
 
62
AC_CANONICAL_HOST
 
63
 
 
64
platform_osx=false
 
65
case $host in
 
66
     *-*-darwin*)
 
67
        # This will break if someone wants to build the X11 version of reinteract
 
68
        # on OS X. They can just use bin/uninst.py, or they can figure out how
 
69
        # to fix this :-)
 
70
        platform_osx=true
 
71
        PKG_CHECK_MODULES(WRAPPER, [pygobject-2.0 >= 2.12 gtk+-2.0 >= 2.12])
 
72
        JD_CHECK_PYTHON_HEADERS(,[AC_MSG_ERROR(could not find Python headers)])
 
73
 
 
74
        if $use_python_thunks ; then : ; else
 
75
            # Need to figure out how to link against Python at compile time
 
76
            AC_MSG_CHECKING([how to link against Python])
 
77
            reinteract_GET_CONFIG_VAR(python_framework_prefix, PYTHONFRAMEWORKPREFIX)
 
78
            if test x$python_framework_prefix = x ; then
 
79
                reinteract_GET_CONFIG_VAR(python_libdir, LIBDIR)
 
80
                PYTHON_LIBS="-L$python_libdir -lpython$PYTHON_VERSION"
 
81
            else
 
82
                PYTHON_LIBS="-F$python_framework_prefix -framework Python"
 
83
            fi
 
84
            AC_MSG_RESULT($PYTHON_LIBS)
 
85
            AC_SUBST(PYTHON_LIBS)
 
86
 
 
87
            # Test to see if what we found actually works
 
88
            save_CFLAGS="$CFLAGS"
 
89
            CFLAGS="$CFLAGS $PYTHON_INCLUDES"
 
90
            save_LIBS="$LIBS"
 
91
            LIBS="$LIBS $PYTHON_LIBS"
 
92
            AC_LINK_IFELSE(AC_LANG_PROGRAM([#include <Python.h>], [Py_Initialize();]),
 
93
                           :,
 
94
                           AC_MSG_ERROR([Linking against Python didn't work; see config.log for details]))
 
95
            CFLAGS="$save_CFLAGS"
 
96
            LIBS="$save_LIBS"
 
97
        fi
 
98
     ;;
 
99
esac
 
100
AM_CONDITIONAL(PLATFORM_OSX, $platform_osx)
 
101
 
 
102
REINTERACT_PACKAGE_DIR=${pythondir}/$PACKAGE_NAME
 
103
AC_SUBST(REINTERACT_PACKAGE_DIR)
 
104
 
 
105
AC_OUTPUT([ 
 
106
  Makefile
 
107
  dialogs/Makefile
 
108
  data/Makefile
 
109
  bin/reinteract
 
110
])