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

Last change on this file since 857 was 857, checked in by Jari Häkkinen, 14 years ago

Refs #50. AM_CONDITIONALs must be available for all build states.

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