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

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

defining state variable in config.h and when not in base1 mode slice out tests in wenni_test that are base1 specific.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 8.5 KB
Line 
1# Process this file with autoconf to produce a configure script.
2#
3# $Id: configure.ac 849 2008-12-01 21:01:33Z 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])
37
38AM_CONFIG_HEADER([config.h])
39AM_INIT_AUTOMAKE
40
41# Set default programming language
42AC_LANG(C++)
43
44# Let user overide default CXXFLAGS
45if test "${CXXFLAGS+set}" != set; then
46  CXXFLAGS=""  # Setting CXXFLAGS here to prevent expansion in AC_PROG_CXX
47fi
48
49# Checks for programs.
50AC_PROG_CXXCPP
51AC_PROG_CXX
52AC_PROG_INSTALL
53AC_PROG_LIBTOOL
54AC_PROG_RANLIB
55AC_PROG_SED
56
57# existence of wget and tar should be checked
58
59AM_CXXFLAGS="-Wall -pedantic"
60AM_CPPFLAGS="-DHAVE_INLINE=1"
61AC_ARG_ENABLE(debug,
62              [AS_HELP_STRING([--enable-debug],
63                              [turn on debug options and code])],
64              [AM_CXXFLAGS="$AM_CXXFLAGS -g -O"],
65              [AM_CXXFLAGS="$AM_CXXFLAGS -O3"
66               AM_CPPFLAGS="$AM_CPPFLAGS -DNDEBUG -DGSL_RANGE_CHECK_OFF"])
67
68AC_ARG_ENABLE(state,
69              [AS_HELP_STRING([--enable-state],
70                              [stand-alone, base1, or base2 [default=base2]])],
71              [ if test "x$enableval" = "xstand-alone" ; then
72                    state="stand-alone"
73                elif test "x$enableval" = "xbase1" ; then
74                    state="base1"
75                elif test "x$enableval" = "xbase2" ; then
76                    state="base2"
77                else
78                    AC_MSG_ERROR([dnl
79Unknown value for `--enable-state'
80allowed values are: `base2', `base1', or `stand-alone'])
81                fi ],
82              [ state="base2" ])
83
84AC_DEFINE_UNQUOTED([WeNNI_STATE], ["$state"],
85                   [defined to configured state - base1, base2, or stand-alone])
86AM_CONDITIONAL([BASE1], [test x$state = xbase1])
87AM_CONDITIONAL([BASE2], [test x$state = xbase2])
88
89AC_ARG_ENABLE(downloadBASE2API,
90              [AS_HELP_STRING([--enable-downloadBASE2API=ARG],
91                              [enable download of required BASE2 API files])],
92              [DOWNLOADBASE2API=true],[DOWNLOADBASE2API=false])
93
94AC_ARG_WITH(basedir,[AS_HELP_STRING([--with-basedir=DIR],
95                                    [root directory for base installation])],
96            [BASEDIR=$withval DOWNLOADBASE2API=false],[BASEDIR=/usr/local/base])
97
98AC_ARG_WITH(plugindir,[AS_HELP_STRING([--with-plugindir=DIR],
99                                      [the base plug-in install directory])],
100            [PLUGINDIR=$withval],
101            [if (test x$state = xbase1); then
102               PLUGINDIR="$BASEDIR/plugins/bin/wenni"
103             elif (test x$state = xbase2); then
104               PLUGINDIR="$BASEDIR/plugins/se/lu/thep/wenni"
105             fi])
106
107if (test x$state = xbase1); then
108  # check for BASE1 API
109  save_CPPFLAGS=$CPPFLAGS;
110  save_LDFLAGS=$LDFLAGS;
111  LDFLAGS="$LDFLAGS -L$BASEDIR/lib"
112  AC_CHECK_LIB([base], [base_finite], [BASELDFLAGS="-L$BASEDIR/lib"],
113               [AC_MSG_FAILURE([cannot find base library])])
114  CPPFLAGS="-I$BASEDIR/include/cxx $CPPFLAGS"
115  AC_CHECK_HEADERS([basefile.h],[BASECPPFLAGS=-I$BASEDIR/include/cxx],
116               [AC_MSG_FAILURE([cannot find base header files])])
117  CPPFLAGS=$save_CPPFLAGS;
118  LDFLAGS=$save_LDFLAGS;
119  AC_SUBST(BASECPPFLAGS)
120  AC_SUBST(BASELDFLAGS)
121  # Set BASE1 plug-in name
122  BASEPLUGINEXECNAME=$PLUGINDIR/wenni.pl
123  AC_SUBST(BASEPLUGINEXECNAME)
124  AC_CONFIG_FILES([base/base1/base_plugin_script/plugin_WeNNI.base])
125elif (test x$state = xbase2); then
126  if (test $DOWNLOADBASE2API = false); then
127    AC_CHECK_FILE([$BASEDIR/www/WEB-INF/lib/BASE2Core.jar], [],
128                  [AC_MSG_FAILURE([cannot find BASE2Core.jar])])
129    JAVACFLAGS+=$BASEDIR/www/WEB-INF/lib/BASE2Core.jar
130    AC_CHECK_FILE([$BASEDIR/www/WEB-INF/lib/BASE2CorePlugins.jar], [],
131                  [AC_MSG_FAILURE([cannot find BASE2CorePlugins.jar])])
132    JAVACFLAGS="$BASEDIR/www/WEB-INF/lib/BASE2CorePlugins.jar:$JAVACFLAGS"
133  fi
134  PLUGINutilitiesURL="http://baseplugins.thep.lu.se/attachment/wiki/net.sf.basedb.pluginutilties/PluginUtilities-0.1pre.tgz?format=raw"
135  PLUGINutilities=PluginUtilities-0.1pre
136  JAVACFLAGS="$JAVACFLAGS:./$PLUGINutilities/$PLUGINutilities.jar"
137  AC_SUBST(PLUGINutilities)
138  AC_SUBST(PLUGINutilitiesURL)
139  AC_SUBST(JAVACFLAGS)
140fi
141if (test x$state = xbase1 || test x$state = xbase2); then
142  # Change binary installation directory, is this kosher?
143  bindir=$PLUGINDIR
144fi
145
146AC_SEARCH_LIBS([sqrt], [m],, AC_MSG_FAILURE([cannot find math library]))
147AC_SEARCH_LIBS([ATL_ctrsv], [atlas],,
148               AC_SEARCH_LIBS(cblas_sdsdot, gslcblas,,
149                        AC_MSG_FAILURE([cannot find cblas library])))
150
151save_LDFLAGS="$LDFLAGS"
152AC_ARG_WITH(gsl,[AS_HELP_STRING([--with-gsl=DIR], [prefix for gsl files])],
153            [GSL_CPPFLAGS="-I$withval/include"; GSL_LDFLAGS="-L$withval/lib"])
154LDFLAGS="$LDFLAGS $GSL_LDFLAGS"
155AC_SEARCH_LIBS([gsl_vector_alloc], [gsl],,
156               AC_MSG_FAILURE([cannot find library GSL]))
157LDFLAGS="$save_LDFLAGS"
158
159AC_SUBST(GSL_LDFLAGS)
160AM_CPPFLAGS="-I\$(top_srcdir)/lib $GSL_CPPFLAGS $AM_CPPFLAGS"
161AC_SUBST(AM_CPPFLAGS)
162AC_SUBST(AM_CXXFLAGS)
163
164CPP_TOOLS_LIBPATH="lib/c++_tools"
165AC_SUBST(CPP_TOOLS_LIBPATH)
166
167AC_CONFIG_FILES([Makefile
168                 base/Makefile
169                 base/base1/Makefile
170                 base/base1/base_plugin_script/Makefile
171                 base/base1/BaseFileConverter/Makefile
172                 base/base2/Makefile
173                 bin/Makefile
174                 bin/NNIFileConverter/Makefile
175                 bin/nni/Makefile
176                 data/Makefile
177                 lib/Makefile
178                 lib/c++_tools/Makefile
179                 lib/c++_tools/gslapi/Makefile
180                 lib/c++_tools/utility/Makefile
181                 test/Makefile])
182
183AC_OUTPUT
184
185# Some more messages.
186AC_MSG_NOTICE([])
187AC_MSG_NOTICE([Ready to build WeNNI package containing])
188AC_MSG_NOTICE([])
189if (test x$state = xbase1); then
190  AC_MSG_NOTICE([BASE1 plug-in files:])
191  AC_MSG_NOTICE([    NNIFileConverter])
192  AC_MSG_NOTICE([    nni])
193  AC_MSG_NOTICE([    BaseFileConverter])
194  AC_MSG_NOTICE([    base_plugin_script])
195  AC_MSG_NOTICE([])
196  AC_MSG_NOTICE([WeNNI plug-in binaries will be installed in])
197  AC_MSG_NOTICE([    $PLUGINDIR ])
198elif (test x$state = xbase2); then
199  AC_MSG_NOTICE([BASE2 plug-in files:])
200  AC_MSG_NOTICE([    nni])
201  AC_MSG_NOTICE([    WeNNI.jar])
202  AC_MSG_NOTICE([    $PLUGINutilities.jar])
203  AC_MSG_NOTICE([])
204  AC_MSG_NOTICE([If not already there, downloading])
205  AC_MSG_NOTICE([    $PLUGINutilitiesURLpart/$PLUGINutilities])
206  AC_MSG_NOTICE([])
207  if (test $DOWNLOADBASE2API = true ); then
208    AC_MSG_NOTICE([Downloading required BASE2 API from ...])
209  else
210    AC_MSG_NOTICE([Using local BASE2 API in directory])
211    AC_MSG_NOTICE([    $BASEDIR])
212  fi
213  AC_MSG_NOTICE([])
214  AC_MSG_NOTICE([WeNNI plug-in binaries will be installed in])
215  AC_MSG_NOTICE([    $PLUGINDIR ])
216else
217  AC_MSG_NOTICE([stand-alone binaries:])
218  AC_MSG_NOTICE([    NNIFileConverter])
219  AC_MSG_NOTICE([    nni])
220fi
221AC_MSG_NOTICE([])
222AC_MSG_NOTICE([The following libs and flags will be used:])
223AC_MSG_NOTICE([+++++++++++++++++++++++++++++++++++++++++++++++])
224AC_MSG_NOTICE([  CPPFLAGS     = $CPPFLAGS $AM_CPPFLAGS])
225AC_MSG_NOTICE([  CXXFLAGS     = $CXXFLAGS $AM_CXXFLAGS])
226AC_MSG_NOTICE([  LDFLAGS      = $LDFLAGS])
227AC_MSG_NOTICE([  LIBS         = $LIBS])
228if (test x$state = xbase1); then
229  AC_MSG_NOTICE([  BASECPPFLAGS = $BASECPPFLAGS])
230  AC_MSG_NOTICE([  BASELDFLAGS  = $BASELDFLAGS])
231elif (test x$state = xbase2); then
232  AC_MSG_NOTICE([  JAVACFLAGS   = $JAVACFLAGS])
233fi
234AC_MSG_NOTICE([+++++++++++++++++++++++++++++++++++++++++++++++])
235AC_MSG_NOTICE([])
236AC_MSG_NOTICE([ Now type 'make ; make check ; make install'.])
Note: See TracBrowser for help on using the repository browser.