source: plugins/base1/se.lu.thep.wenni/trunk/configure.ac @ 860

Last change on this file since 860 was 860, checked in by Peter Johansson, 14 years ago

adding tests for javac and jar - refs #153

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 9.0 KB
Line 
1# Process this file with autoconf to produce a configure script.
2#
3# $Id: configure.ac 860 2008-12-02 20:31:43Z peter $
4#
5# Copyright (C) 2005, 2006 Jari Häkkinen, Peter Johansson
6# Copyright (C) 2007 Peter Johansson
7# Copyright (C) 2008 Jari Häkkinen, Peter Johansson
8#
9# This file is part of WeNNI,
10# http://baseplugins.thep.lu.se/wiki/se.lu.thep.WeNNI
11#
12# WeNNI is free software; you can redistribute it and/or modify it
13# under the terms of the GNU General Public License as published by the
14# Free Software Foundation; either version 3 of the License, or (at
15# your option) any later version.
16#
17# WeNNI is distributed in the hope that it will be useful, but WITHOUT
18# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
19# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
20# for more details.
21#
22# You should have received a copy of the GNU General Public License
23# along with WeNNI. If not, see <http://www.gnu.org/licenses/>.
24#
25# Author: Jari Hakkinen, jari@thep.lu.se
26#
27# If you grabbed the source from subversion you should, at top-level,
28# execute:
29#   ./bootstrap
30#
31
32AC_PREREQ(2.57)
33AC_INIT([wenni],[0.7pre],[jari@thep.lu.se])
34AC_CONFIG_SRCDIR([lib/weight.h])
35AC_CONFIG_AUX_DIR([autotools])
36AC_PREFIX_DEFAULT([/usr/local])
37AC_CONFIG_MACRO_DIR([m4])
38
39# Build configuration parameters, change only if you know what you do
40BASE2CoreURL="http://base2.thep.lu.se/base/jars/2.9.0"
41PLUGINutilitiesURL="http://baseplugins.thep.lu.se/attachment/wiki/net.sf.basedb.pluginutilties/PluginUtilities-0.1pre.tgz?format=raw"
42PLUGINutilities=PluginUtilities-0.1pre
43
44AM_CONFIG_HEADER([config.h])
45AM_INIT_AUTOMAKE
46
47# Set default programming language
48AC_LANG(C++)
49
50# Let user overide default CXXFLAGS
51if test "${CXXFLAGS+set}" != set; then
52  CXXFLAGS=""  # Setting CXXFLAGS here to prevent expansion in AC_PROG_CXX
53fi
54
55# Checks for programs.
56AC_PROG_CXXCPP
57AC_PROG_CXX
58AC_PROG_INSTALL
59AC_PROG_LIBTOOL
60AC_PROG_RANLIB
61AC_PROG_SED
62
63# existence of wget and tar should be checked
64
65AM_CXXFLAGS="-Wall -pedantic"
66AM_CPPFLAGS="-DHAVE_INLINE=1"
67AC_ARG_ENABLE(debug,
68              [AS_HELP_STRING([--enable-debug],
69                              [turn on debug options and code])],
70              [AM_CXXFLAGS="$AM_CXXFLAGS -g -O"],
71              [AM_CXXFLAGS="$AM_CXXFLAGS -O3"
72               AM_CPPFLAGS="$AM_CPPFLAGS -DNDEBUG -DGSL_RANGE_CHECK_OFF"])
73
74AC_ARG_ENABLE(state,
75              [AS_HELP_STRING([--enable-state],
76                              [stand-alone, base1, or base2 [default=base2]])],
77              [ if test "x$enableval" = "xstand-alone" ; then
78                    state="stand-alone"
79                elif test "x$enableval" = "xbase1" ; then
80                    state="base1"
81                elif test "x$enableval" = "xbase2" ; then
82                    state="base2"
83                else
84                    AC_MSG_ERROR([dnl
85Unknown value for `--enable-state'
86allowed values are: `base2', `base1', or `stand-alone'])
87                fi ],
88              [ state="base2" ])
89
90AC_DEFINE_UNQUOTED([WeNNI_STATE], ["$state"],
91                   [defined to configured state - base1, base2, or stand-alone])
92AM_CONDITIONAL([BASE1], [test x$state = xbase1])
93AM_CONDITIONAL([BASE2], [test x$state = xbase2])
94
95AC_ARG_ENABLE(downloadBASE2API,
96              [AS_HELP_STRING([--enable-downloadBASE2API=ARG],
97                              [enable download of required BASE2 API files])],
98              [DOWNLOADBASE2API=true],[DOWNLOADBASE2API=false])
99AC_ARG_WITH(basedir,[AS_HELP_STRING([--with-basedir=DIR],
100                                    [root directory for base installation])],
101            [BASEDIR=$withval DOWNLOADBASE2API=false],
102            [BASEDIR=/usr/local/base DOWNLOADBASE2API=true])
103AM_CONDITIONAL([DOWNLOADBASEAPI], [test $DOWNLOADBASE2API = true])
104
105AC_ARG_WITH(plugindir,[AS_HELP_STRING([--with-plugindir=DIR],
106                                      [the base plug-in install directory])],
107            [PLUGINDIR=$withval],
108            [PLUGINDIR=$bindir
109             if (test x$state = xbase1); then
110               PLUGINDIR="$BASEDIR/plugins/bin/wenni"
111             elif (test x$state = xbase2); then
112               PLUGINDIR="$BASEDIR/plugins/se/lu/thep/wenni"
113             fi])
114AC_SUBST(PLUGINDIR)
115
116if (test x$state = xbase1); then
117  # check for BASE1 API
118  save_CPPFLAGS=$CPPFLAGS;
119  save_LDFLAGS=$LDFLAGS;
120  LDFLAGS="$LDFLAGS -L$BASEDIR/lib"
121  AC_CHECK_LIB([base], [base_finite], [BASELDFLAGS="-L$BASEDIR/lib"],
122               [AC_MSG_FAILURE([cannot find base library])])
123  CPPFLAGS="-I$BASEDIR/include/cxx $CPPFLAGS"
124  AC_CHECK_HEADERS([basefile.h],[BASECPPFLAGS=-I$BASEDIR/include/cxx],
125               [AC_MSG_FAILURE([cannot find base header files])])
126  CPPFLAGS=$save_CPPFLAGS;
127  LDFLAGS=$save_LDFLAGS;
128  AC_SUBST(BASECPPFLAGS)
129  AC_SUBST(BASELDFLAGS)
130  # Set BASE1 plug-in name
131  BASEPLUGINEXECNAME=$PLUGINDIR/wenni.pl
132  AC_SUBST(BASEPLUGINEXECNAME)
133  AC_CONFIG_FILES([base/base1/base_plugin_script/plugin_WeNNI.base])
134elif (test x$state = xbase2); then
135  AC_PROG_JAVAC   
136  AC_PROG_JAR   
137  if (test $DOWNLOADBASE2API = false); then
138    AC_CHECK_FILE([$BASEDIR/www/WEB-INF/lib/BASE2Core.jar], [],
139                  [AC_MSG_FAILURE([cannot find BASE2Core.jar])])
140    JAVACFLAGS+=$BASEDIR/www/WEB-INF/lib/BASE2Core.jar
141    AC_CHECK_FILE([$BASEDIR/www/WEB-INF/lib/BASE2CorePlugins.jar], [],
142                  [AC_MSG_FAILURE([cannot find BASE2CorePlugins.jar])])
143    JAVACFLAGS="$BASEDIR/www/WEB-INF/lib/BASE2CorePlugins.jar:$JAVACFLAGS"
144  else
145    JAVACFLAGS="./BaseCoreAPI/BASE2CorePlugins.jar:BaseCoreAPI/BASE2Core.jar:$JAVACFLAGS"
146  fi
147  JAVACFLAGS="$JAVACFLAGS:./$PLUGINutilities/$PLUGINutilities.jar"
148  AC_SUBST(PLUGINutilities)
149  AC_SUBST(PLUGINutilitiesURL)
150  AC_SUBST(BASE2CoreURL)
151  AC_SUBST(JAVACFLAGS)
152fi
153
154AC_SEARCH_LIBS([sqrt], [m],, AC_MSG_FAILURE([cannot find math library]))
155AC_SEARCH_LIBS([ATL_ctrsv], [atlas],,
156               AC_SEARCH_LIBS(cblas_sdsdot, gslcblas,,
157                        AC_MSG_FAILURE([cannot find cblas library])))
158
159save_LDFLAGS="$LDFLAGS"
160AC_ARG_WITH(gsl,[AS_HELP_STRING([--with-gsl=DIR], [prefix for gsl files])],
161            [GSL_CPPFLAGS="-I$withval/include"; GSL_LDFLAGS="-L$withval/lib"])
162LDFLAGS="$LDFLAGS $GSL_LDFLAGS"
163AC_SEARCH_LIBS([gsl_vector_alloc], [gsl],,
164               AC_MSG_FAILURE([cannot find library GSL]))
165LDFLAGS="$save_LDFLAGS"
166
167AC_SUBST(GSL_LDFLAGS)
168AM_CPPFLAGS="-I\$(top_srcdir)/lib $GSL_CPPFLAGS $AM_CPPFLAGS"
169AC_SUBST(AM_CPPFLAGS)
170AC_SUBST(AM_CXXFLAGS)
171
172CPP_TOOLS_LIBPATH="lib/c++_tools"
173AC_SUBST(CPP_TOOLS_LIBPATH)
174
175AC_CONFIG_FILES([Makefile
176                 base/Makefile
177                 base/base1/Makefile
178                 base/base1/base_plugin_script/Makefile
179                 base/base1/BaseFileConverter/Makefile
180                 base/base2/Makefile
181                 bin/Makefile
182                 bin/NNIFileConverter/Makefile
183                 bin/nni/Makefile
184                 data/Makefile
185                 lib/Makefile
186                 lib/c++_tools/Makefile
187                 lib/c++_tools/gslapi/Makefile
188                 lib/c++_tools/utility/Makefile
189                 test/Makefile])
190
191AC_OUTPUT
192
193
194# Some more messages.
195AC_MSG_NOTICE([])
196AC_MSG_NOTICE([Ready to build WeNNI package containing])
197AC_MSG_NOTICE([])
198if (test x$state = xbase1); then
199  AC_MSG_NOTICE([BASE1 plug-in files:])
200  AC_MSG_NOTICE([    NNIFileConverter])
201  AC_MSG_NOTICE([    nni])
202  AC_MSG_NOTICE([    BaseFileConverter])
203  AC_MSG_NOTICE([    wenni.pl])
204  AC_MSG_NOTICE([])
205  AC_MSG_NOTICE([WeNNI plug-in binaries will be installed in])
206  AC_MSG_NOTICE([    $PLUGINDIR ])
207elif (test x$state = xbase2); then
208  AC_MSG_NOTICE([BASE2 plug-in files:])
209  AC_MSG_NOTICE([    nni])
210  AC_MSG_NOTICE([    WeNNI.jar])
211  AC_MSG_NOTICE([    $PLUGINutilities.jar])
212  AC_MSG_NOTICE([])
213  AC_MSG_NOTICE([If not already done, downloading])
214  AC_MSG_NOTICE([    $PLUGINutilitiesURL])
215  if (test $DOWNLOADBASE2API = true ); then
216    AC_MSG_NOTICE([    BASE2 libraries from $BASE2CoreURL])
217  else
218    AC_MSG_NOTICE([])
219    AC_MSG_NOTICE([Using local BASE2 API in directory])
220    AC_MSG_NOTICE([    $BASEDIR])
221  fi
222  AC_MSG_NOTICE([])
223  AC_MSG_NOTICE([WeNNI plug-in binaries will be installed in])
224  AC_MSG_NOTICE([    $PLUGINDIR ])
225else
226  AC_MSG_NOTICE([stand-alone binaries:])
227  AC_MSG_NOTICE([    NNIFileConverter])
228  AC_MSG_NOTICE([    nni])
229  AC_MSG_NOTICE([])
230  AC_MSG_NOTICE([binaries will be installed in])
231  AC_MSG_NOTICE([    $bindir])
232fi
233AC_MSG_NOTICE([])
234AC_MSG_NOTICE([The following libs and flags will be used:])
235AC_MSG_NOTICE([+++++++++++++++++++++++++++++++++++++++++++++++])
236AC_MSG_NOTICE([  CPPFLAGS     = $CPPFLAGS $AM_CPPFLAGS])
237AC_MSG_NOTICE([  CXXFLAGS     = $CXXFLAGS $AM_CXXFLAGS])
238AC_MSG_NOTICE([  LDFLAGS      = $LDFLAGS])
239AC_MSG_NOTICE([  LIBS         = $LIBS])
240if (test x$state = xbase1); then
241  AC_MSG_NOTICE([  BASECPPFLAGS = $BASECPPFLAGS])
242  AC_MSG_NOTICE([  BASELDFLAGS  = $BASELDFLAGS])
243elif (test x$state = xbase2); then
244  AC_MSG_NOTICE([  JAVACFLAGS   = $JAVACFLAGS])
245fi
246AC_MSG_NOTICE([+++++++++++++++++++++++++++++++++++++++++++++++])
247AC_MSG_NOTICE([])
248if (test x$state = xbase1 || test x$state = xbase2); then
249  AC_MSG_NOTICE([ Now type 'make ; make check ; make install-plugin'.])
250else
251  AC_MSG_NOTICE([ Now type 'make ; make check ; make install'.])
252fi
Note: See TracBrowser for help on using the repository browser.