Synopsis - Cross-Reference

File: /tests/configure.ac
 1dnl
 2dnl Copyright (C) 2003 Stefan Seefeld
 3dnl All rights reserved.
 4dnl Licensed to the public under the terms of the GNU LGPL (>= 2),
 5dnl see the file COPYING for details.
 6dnl
 7
 8AC_PREREQ(2.56)
 9AC_REVISION($Revision: 1.1 $)
10AC_INIT(tests, 1.0, synopsis-devel@fresco.org)
11
12AC_ARG_WITH(python, 
13  [  --with-python=PATH      specify the Python interpreter],
14  PYTHON="$with_python",
15  PYTHON="python"
16)
17
18AC_ARG_WITH(syn-cxx,
19  [  --with-syn-cxx=PATH     specify the Synopsis C++ library prefix],
20  SYN_CXX="$with_syn_cxx",
21  SYN_CXX="/usr/local"
22)
23
24AC_PROG_CXX
25
26SYN_CPP="`PKG_CONFIG_PATH=$SYN_CXX pkg-config --cflags synopsis-uninstalled`"
27SYN_LIBS="`PKG_CONFIG_PATH=$SYN_CXX pkg-config --libs synopsis-uninstalled`"
28CPPFLAGS="$CPPFLAGS $SYN_CPP"
29LIBS="$LIBS $SYN_LIBS"
30
31if test -n "$PYTHON" -a "$PYTHON" != yes; then
32  AC_CHECK_PROG(PYTHON, $PYTHON, AC_MSG_ERROR([Cannot find Python interpreter]))
33else
34  AC_PATH_PROG(PYTHON, python2 python, python)
35fi
36PYTHON_PREFIX=`$PYTHON -c "import sys; print sys.prefix"`
37PYTHON_INCLUDE=`$PYTHON -c "from distutils import sysconfig; print sysconfig.get_python_inc()"`
38PYTHON_VERSION=`$PYTHON -c "from distutils import sysconfig; print sysconfig.get_config_var('VERSION')"`
39PYTHON_LIBS="-L $PYTHON_PREFIX/lib/python$PYTHON_VERSION/config -lpython$PYTHON_VERSION"
40PYTHON_DEP_LIBS=`$PYTHON -c "from distutils import sysconfig; print sysconfig.get_config_var('LIBS') or ''"`
41
42case `uname -s` in
43CYGWIN*)
44    if test `$PYTHON -c "import os; print os.name"` = posix; then
45dnl Cygwin doesn't have an -lutil, but some versions of distutils tell us to use it anyway.
46dnl It would be better to check for each library it tells us to use with AC_CHECK_LIB, but
47dnl to do that, we need the name of a function in each one, so we'll just hack -lutil out 
48dnl of the list.
49      PYTHON_DEP_LIBS=`$PYTHON -c "from distutils import sysconfig; import re; print re.sub(r'\\s*-lutil', '', sysconfig.get_config_var('LIBS') or '')"`
50    else dnl this is 'nt'
51      if test "$CXX" = "g++"; then
52        CXXFLAGS="-mno-cygwin $CXXFLAGS"
53        LDFLAGS="-mno-cygwin $LDFLAGS"
54      fi
55      PYTHON_INCLUDE=`cygpath -a $PYTHON_INCLUDE`
56      PYTHON_DEP_LIBS=`$PYTHON -c "from distutils import sysconfig; print sysconfig.get_config_var('LIBS') or ''"`
57    fi
58    CXXFLAGS="-D_REENTRANT $CXXFLAGS"
59    LDFLAGS="-rdynamic $LDFLAGS"
60    ;;
61*)
62    LDFLAGS="-rdynamic $LDFLAGS"
63    ;;
64esac
65
66CPPFLAGS="-I $PYTHON_INCLUDE $CPPFLAGS"
67LIBS="$LIBS $PYTHON_LIBS $PYTHON_DEP_LIBS"
68
69dnl find all template files and strip off the $srcdir and .in suffix
70templates=`find $srcdir -name '*.in' -print | sed -e "s,^$srcdir/,,g" -e "s,\.in$,,g"`
71
72AC_CONFIG_FILES([$templates])
73
74mkdir -p Cxx/src
75mkdir -p Cxx/bin
76
77AC_OUTPUT
78