Synopsis - Cross-Reference

File: /src/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
  8dnl ------------------------------------------------------------------
  9dnl Autoconf initialization
 10dnl ------------------------------------------------------------------
 11AC_PREREQ(2.56)
 12AC_REVISION($Revision: 1.9 $)
 13AC_INIT(libSynopsis, 1.0, synopsis-devel@fresco.org)
 14
 15AC_ARG_ENABLE(version,
 16  [  --enable-version=VERSION      specify the Synopsis version to build],
 17  [version=$enableval],
 18  [version="1.0"]
 19)
 20
 21AC_ARG_WITH(python, 
 22  [  --with-python=PATH      specify the Python interpreter],
 23  PYTHON="$with_python",
 24  PYTHON="python"
 25)
 26
 27AC_ARG_ENABLE([gc], 
 28  [  --disable-gc            don't use garbage collector (default is enabled)],
 29  [ac_cv_enable_gc=no],
 30  [ac_cv_enable_gc=yes])
 31
 32AC_ARG_WITH([gc_prefix],
 33  [  --with-gc-prefix=PATH   specify the prefix to the garbage collector],
 34  [ac_cv_with_gc_prefix="$with_gc_prefix"],
 35  [ac_cv_with_gc_prefix=""])
 36
 37
 38AC_PROG_CPP
 39AC_PROG_CC
 40AC_PROG_CXX
 41AC_PROG_RANLIB
 42AC_CHECK_PROGS(AR, ar aal xiar, ar)
 43AC_CHECK_PROGS(LD, ld xild, ld)
 44AC_SUBST(AR)
 45AC_SUBST(LD)
 46AC_PROG_LN_S
 47AC_PROG_INSTALL
 48
 49# Determine major, minor, and bugfix version
 50if echo "$version" | grep -q '\.'; then
 51    # there's one or more '.'s in release (e.g. 0.8 or 0.9.1)
 52    major=$(echo "$version" | sed -e 's/\.[[0-9.]]*$//')
 53    minor=$(echo "$version" | sed -e 's/^[[0-9]]*\.//')
 54else
 55    # there's no '.' in release (e.g. 9)
 56    major=$version
 57fi
 58AC_SUBST(MAJOR, $major)
 59AC_SUBST(MINOR, $minor)
 60
 61if test -n "$PYTHON" -a "$PYTHON" != yes; then
 62  AC_CHECK_PROG(PYTHON,,AC_MSG_ERROR([Cannot find Python interpreter]))
 63else
 64  AC_PATH_PROG(PYTHON, python2 python, python)
 65fi
 66
 67if test "$ac_cv_enable_gc" == "yes"; then
 68  GC_BRIDGE=$srcdir/Synopsis/PTree/GC-enabled.tmpl
 69  if test -n "$ac_cv_with_gc_prefix"; then
 70    CPPFLAGS="$CPPFLAGS -I$ac_cv_with_gc_prefix/include/gc"
 71    LIBS="-L$ac_cv_with_gc_prefix/lib -lgc $LIBS"
 72  else
 73    GC_CPP="-I\${includedir}/Synopsis/gc/include"
 74    GC_LIB="Synopsis/gc/.libs/libgc.a"
 75    dnl We need to link with posix threads since libgc wants it.
 76    SYN_SEARCH_PTHREAD
 77  fi
 78else
 79  GC_BRIDGE=$srcdir/Synopsis/PTree/GC-disabled.tmpl
 80fi
 81AC_SUBST(GC_CPP)
 82AC_SUBST(GC_LIB)
 83
 84AC_SUBST_FILE(GC_BRIDGE)
 85
 86PLATFORM=`$PYTHON -c "import os; print os.name" | tr -d "\r"`
 87
 88case `uname -s` in
 89CYGWIN*)
 90    LIBEXT=".dll"
 91    LDSHARED="$CXX -shared"
 92    LDSONAME="-Wl,--soname,"
 93    CXXFLAGS="-D_REENTRANT $CXXFLAGS"
 94    if test "$PLATFORM" == "nt"; then
 95      if test "$CXX" == "g++"; then
 96        CPPFLAGS="$CPPFLAGS -D PARSE_MSVC"
 97        CFLAGS="-mno-cygwin $CFLAGS"
 98        CXXFLAGS="-mno-cygwin $CXXFLAGS"
 99        LDFLAGS="-mno-cygwin $LDFLAGS"
100      fi
101    else
102      PLATFORM="cygwin"
103    fi
104    ;;
105Darwin)
106    LIBEXT=".dylib"
107    LDSHARED="$CXX -dynamiclib"
108    LDSONAME="-Wl,-install_name,"
109    CXXFLAGS="-D_REENTRANT $CXXFLAGS -fPIC"
110    ;;
111*)
112    LIBEXT=".so"
113    LDSHARED="$CXX -shared"
114    LDSONAME="-Wl,--soname,"
115    CXXFLAGS="-D_REENTRANT $CXXFLAGS -fPIC"
116    ;;
117esac
118
119AC_SUBST(PLATFORM)
120AC_SUBST(LIBEXT)
121AC_SUBST(LDSHARED)
122AC_SUBST(LDSONAME)
123
124AC_CONFIG_FILES([Synopsis/PTree/GC.hh
125                 Makefile 
126                 synopsis.py 
127                 synopsis-uninstalled.pc
128                 synopsis.pc])
129
130mkdir -p lib
131mkdir -p bin
132mkdir -p Synopsis/gc
133mkdir -p Synopsis/PTree
134mkdir -p Synopsis/SymbolLookup
135mkdir -p Synopsis/TypeAnalysis
136mkdir -p Support
137mkdir -p tools
138
139AC_OUTPUT