1 |
# configure.ac |
2 |
|
3 |
## Process this file with autoconf to create configure. -*- autoconf -*- |
4 |
# Copyright (c) 2002 Thomas Degris |
5 |
|
6 |
# http://www.freesoftware.fsf.org/satom/ |
7 |
|
8 |
# This program is free software; you can redistribute it and/or |
9 |
# modify it under the terms of the GNU General Public License as |
10 |
# published by the Free Software Foundation; either version 2 of the |
11 |
# License, or (at your option) any later version. |
12 |
|
13 |
# This program is distributed in the hope that it will be useful, |
14 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 |
# GNU General Public License for more details. |
17 |
|
18 |
# You should have received a copy of the GNU General Public License |
19 |
# along with this program; if not, write to the Free Software |
20 |
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 |
21 |
# USA |
22 |
|
23 |
AC_INIT |
24 |
AC_CONFIG_SRCDIR([src/satom/satom.hpp]) |
25 |
AC_CANONICAL_TARGET |
26 |
AM_INIT_AUTOMAKE(satom, 0.0.1) |
27 |
AC_CONFIG_HEADERS([config.h]) |
28 |
AC_PREREQ(2.59) |
29 |
|
30 |
dnl Checking for programs |
31 |
AC_PROG_CC |
32 |
AC_PROG_CPP |
33 |
AC_PROG_CXX |
34 |
AC_PROG_INSTALL |
35 |
|
36 |
dnl Check for dlopen support |
37 |
AC_LIBTOOL_DLOPEN |
38 |
dnl Enable building of the convenience library |
39 |
dnl and set LIBLTDL accordingly |
40 |
AC_LIBLTDL_CONVENIENCE |
41 |
dnl Substitute LTDLINCL and LIBLTDL in the Makefiles |
42 |
AC_SUBST(INCLTDL) |
43 |
AC_SUBST(LIBLTDL) |
44 |
dnl Configure libltdl |
45 |
AC_CONFIG_SUBDIRS(libltdl) |
46 |
dnl Configure libtool |
47 |
AM_DISABLE_STATIC |
48 |
AM_ENABLE_SHARED |
49 |
AC_LIBTOOL_WIN32_DLL |
50 |
AM_PROG_LIBTOOL |
51 |
|
52 |
dnl Selection the language |
53 |
AC_LANG([C++]) |
54 |
AC_CHECK_LIB(stdc++, main,,AC_MSG_ERROR(Satom requires stdc++)) |
55 |
|
56 |
dnl Checking for headers file |
57 |
AC_HEADER_STDC([]) |
58 |
AC_CHECK_HEADERS(dirent.h stdio.h assert.h time.h pthread.h) |
59 |
|
60 |
dnl Checking for functions |
61 |
AC_CHECK_FUNCS(readlink, , ) |
62 |
|
63 |
dnl Fix the conditional for Darwin operating system |
64 |
AM_CONDITIONAL(DARWINSYSTEM, [ test `uname` = "Darwin" ]) |
65 |
|
66 |
dnl Checking system type |
67 |
SYSTEM=`uname` |
68 |
echo "System type is : "$SYSTEM |
69 |
|
70 |
dnl Enable debug mode flags |
71 |
AC_ARG_ENABLE(debug, |
72 |
[ --enable-debug[[=ARG]] compile in debug info default=no],[ |
73 |
if test "$enable_debug" = "yes"; then |
74 |
CFLAGS="-g3 -Wall -pedantic-errors -fmessage-length=0" |
75 |
if test `uname` = "Darwin"; then |
76 |
CFLAGS="$CFLAGS -ggdb3 -fPIC" |
77 |
elif test `uname | grep MINGW`; then |
78 |
CFLAGS="$CFLAGS" |
79 |
else |
80 |
CFLAGS="$CFLAGS -gdwarf-2 -fPIC" |
81 |
fi |
82 |
CXXFLAGS="$CFLAGS" |
83 |
fi |
84 |
],[ |
85 |
CFLAGS="-O2 -fmessage-length=0" |
86 |
if test `uname | grep MINGW`; then |
87 |
CFLAGS="$CFLAGS" |
88 |
else |
89 |
CFLAGS="$CFLAGS -fPIC" |
90 |
fi |
91 |
CXXFLAGS="$CFLAGS" |
92 |
]) |
93 |
|
94 |
dnl Enable profiler mode |
95 |
AC_ARG_ENABLE(profile, |
96 |
[ --enable-profile[[=ARG]] compile with gprof profiler default=no],[ |
97 |
if test "$enable_profile" = "yes"; then |
98 |
CFLAGS="$CFLAGS -pg " |
99 |
CXXFLAGS="$CXXFLAGS -pg " |
100 |
LDFLAGS="${LDFLAGS} -pg" |
101 |
fi |
102 |
]) |
103 |
|
104 |
dnl Checking for doxygen |
105 |
AC_PATH_PROG(DOXYGEN, "doxygen", "",) |
106 |
|
107 |
dnl Checking for trang |
108 |
AC_PATH_PROG(TRANG, "trang", "",) |
109 |
|
110 |
dnl Checking for libxml2 |
111 |
AC_ARG_WITH(libxml2, |
112 |
[ --with-libxml2-prefix[[=DIR]] use libxml2 in DIR],[ |
113 |
if test "$withval" != "no" -a "$withval" != "yes"; then |
114 |
LIBXML2_DIR=$withval |
115 |
CPPFLAGS="${CPPFLAGS} -I$withval/include" |
116 |
LDFLAGS="${LDFLAGS} -L$withval" |
117 |
fi |
118 |
]) |
119 |
AC_PATH_PROG(XML2CONFIG, "xml2-config", "no", [${PATH}:${LIBXML2_DIR}/bin:${LIBXML2_DIR}]) |
120 |
if test "$XML2CONFIG" = "no"; then |
121 |
AC_MSG_ERROR(Satom requires libxml2) |
122 |
fi |
123 |
|
124 |
dnl Checking for libxslt |
125 |
AC_ARG_WITH(libxslt, |
126 |
[ --with-libxslt-prefix[[=DIR]] use libxslt in DIR],[ |
127 |
if test "$withval" != "no" -a "$withval" != "yes"; then |
128 |
LIBXSLT_DIR=$withval |
129 |
CPPFLAGS="${CPPFLAGS} -I$withval" |
130 |
LDFLAGS="${LDFLAGS} -L$withval/libxslt -L$withval/libexslt" |
131 |
fi |
132 |
]) |
133 |
AC_PATH_PROG(XSLTCONFIG, "xslt-config", "no", [${PATH}:${LIBXSLT_DIR}/bin:${LIBXSLT_DIR}]) |
134 |
if test "$XSLTCONFIG" = "no"; then |
135 |
AC_MSG_ERROR(Satom requires libxslt) |
136 |
fi |
137 |
|
138 |
dnl Checking for wsock32 |
139 |
AC_CHECK_LIB(wsock32, main,[LDWINSOCKET="-lwsock32"],) |
140 |
AC_SUBST(LDWINSOCKET) |
141 |
|
142 |
dnl Check wether to use ln or cp |
143 |
AC_CHECK_PROG(LNCONFIG, ln, yes) |
144 |
if test "$LNCONFIG" = "yes"; then |
145 |
LN="ln -f" |
146 |
else |
147 |
LN="cp" |
148 |
fi |
149 |
AC_SUBST(LN) |
150 |
|
151 |
dnl Defines variables |
152 |
|
153 |
AC_DEFINE_UNQUOTED(SATOMPREFIX, "$prefix", Satom prefix installation) |
154 |
AC_DEFINE_UNQUOTED(STIDIR, "$prefix/share/satom/sti/", Xslt Satom folder installation) |
155 |
AC_DEFINE_UNQUOTED(XSLTDIR, "$prefix/share/satom/xslt/", Xslt Satom folder installation) |
156 |
AC_DEFINE_UNQUOTED(ETCDIR, "$prefix/etc/", Xslt Satom folder installation) |
157 |
AC_DEFINE_UNQUOTED(LIBDIR, "$prefix/lib", Library Satom folder installation) |
158 |
AC_DEFINE_UNQUOTED(GRAMMARPATH, "$prefix/share/satom/rng/stc.rng", Rng Satom file installation) |
159 |
|
160 |
if test $SYSTEM = "Darwin" ; then |
161 |
STOS=DARWIN |
162 |
fi |
163 |
|
164 |
if test `echo $SYSTEM | grep MINGW`; then |
165 |
STOS=WIN32 |
166 |
fi |
167 |
|
168 |
if test $SYSTEM = "Linux"; then |
169 |
STOS=LINUX |
170 |
fi |
171 |
AC_SUBST(STOS) |
172 |
|
173 |
|
174 |
if test `uname | grep MINGW`; then |
175 |
EXECUTABLE_EXTENSION=".exe" |
176 |
fi |
177 |
AC_SUBST(EXECUTABLE_EXTENSION) |
178 |
|
179 |
if test "$prefix" = "NONE"; then |
180 |
prefix="$ac_default_prefix" |
181 |
fi |
182 |
SATOM_CFLAGS="-I${includedir}" |
183 |
SATOM_LDFLAGS="-L${libdir} -lsatom" |
184 |
AC_SUBST(SATOM_CFLAGS) |
185 |
AC_SUBST(SATOM_LDFLAGS) |
186 |
|
187 |
echo |
188 |
echo "Satom compilation options" |
189 |
echo "enable-debug = $enable_debug" |
190 |
echo "enable-profile = $enable_profile" |
191 |
echo "CFLAGS = $CFLAGS" |
192 |
echo "CXXFLAGS = $CXXFLAGS" |
193 |
echo "LDFLAGS = $LDFLAGS" |
194 |
echo |
195 |
|
196 |
AC_CONFIG_FILES([ |
197 |
services.db |
198 |
stdoc |
199 |
st.conf |
200 |
satom-config |
201 |
Makefile |
202 |
stconfig.stup |
203 |
stupdate |
204 |
stos.h |
205 |
]) |
206 |
AC_OUTPUT |