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

Last change on this file since 836 was 836, checked in by Peter Johansson, 13 years ago

refs #63. Fixed vpath issues in test so make distcheck no works in stand-alone and base1.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 6.4 KB
Line 
1# Process this file with autoconf to produce a configure script.
2#
3# $Id: configure.ac 836 2008-11-28 17:27:49Z 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# Checks for programs.
45AC_PROG_CPP
46AC_PROG_CXX
47AC_PROG_INSTALL
48AC_PROG_LIBTOOL
49AC_PROG_RANLIB
50
51CXXFLAGS="-Wall -pedantic"
52CPPFLAGS="-DHAVE_INLINE=1"
53AC_ARG_ENABLE(debug,
54              [ AS_HELP_STRING([--enable-debug],
55                               [turn on debug options and code]) ],
56              [ CXXFLAGS="$CXXFLAGS -g -O" ],
57              [ CXXFLAGS="$CXXFLAGS -O3"
58                CPPFLAGS="$CPPFLAGS -DNDEBUG -DGSL_RANGE_CHECK_OFF" ])
59
60AC_ARG_ENABLE(state,
61              [ AS_HELP_STRING([--enable-state],
62                               [stand-alone, base1, or base2 [default=base2]])],
63              [ if test "x$enableval" = "xstand-alone" ; then
64                    state="stand-alone"
65                elif test "x$enableval" = "xbase1" ; then
66                    state="base1"
67                elif test "x$enableval" = "xbase2" ; then
68                    state="base2"
69                else
70                    AC_MSG_ERROR([dnl
71Unknown value for `--enable-state'
72allowed values are: `base2', `base1', or `stand-alone'])
73                fi ],
74              [ state="base2" ])
75
76AM_CONDITIONAL([BASE1], [test x$state = xbase1])
77AM_CONDITIONAL([BASE2], [test x$state = xbase2])
78
79AC_ARG_WITH(basedir,[AS_HELP_STRING([--with-basedir=DIR]),
80                     [root directory for base installation])],
81            [BASEDIR=$withval],[BASEDIR=/usr/local/base])
82
83AC_ARG_WITH(plugindir,[AS_HELP_STRING([--with-plugindir=DIR],
84                      [root directory for base plug-ins])],
85            [PLUGINDIR=$withval],
86            [if (test x$state = xbase1); then
87               PLUGINDIR="$BASEDIR/plugins/bin/wenni"
88             elif (test x$state = xbase2); then
89               PLUGINDIR="$BASEDIR/plugins/se/lu/thep/wenni"
90             fi])
91
92if (test x$state = xbase1); then
93  # check for BASE1 API
94  OLD_CPPFLAGS=$CPPFLAGS;
95  OLD_LDFLAGS=$LDFLAGS;
96  LDFLAGS="-L$BASEDIR/lib"
97  AC_CHECK_LIB([base], [base_finite], [BASELDFLAGS="-L$BASEDIR/lib -lbase"],
98               [AC_MSG_FAILURE([cannot find base library])])
99  CPPFLAGS="-I$BASEDIR/include/cxx $CPPFLAGS"
100  AC_CHECK_HEADERS([basefile.h],[BASECPPFLAGS=-I$BASEDIR/include/cxx],
101               [AC_MSG_FAILURE([cannot find base header files])])
102  CPPFLAGS=$OLD_CPPFLAGS;
103  LDFLAGS=$OLD_LDFLAGS;
104  AC_SUBST(BASECPPFLAGS)
105  AC_SUBST(BASELDFLAGS)
106  # Set BASE1 plug-in name
107  BASEPLUGINEXECNAME=$PLUGINDIR/wenni.pl
108  AC_SUBST(BASEPLUGINEXECNAME)
109  AC_CONFIG_FILES([base/base1/base_plugin_script/plugin_WeNNI.base])
110fi
111if (test x$state = xbase2); then
112  AC_CHECK_FILE([$BASEDIR/www/WEB-INF/lib/BASE2Core.jar], [],
113                [AC_MSG_FAILURE([cannot find BASE2Core.jar])])
114  JAVACFLAGS=$BASEDIR/www/WEB-INF/lib/BASE2Core.jar
115  AC_CHECK_FILE([$BASEDIR/www/WEB-INF/lib/BASE2CorePlugins.jar], [],
116                [AC_MSG_FAILURE([cannot find BASE2CorePlugins.jar])])
117  JAVACFLAGS="$BASEDIR/www/WEB-INF/lib/BASE2CorePlugins.jar:$JAVACFLAGS"
118  AC_SUBST(JAVACFLAGS)
119fi
120
121AC_ARG_WITH(gsl,[AS_HELP_STRING([--with-gsl=DIR], [prefix for gsl files])],
122            [CPPFLAGS="-I$withval/include $CPPFLAGS"
123             LDFLAGS="-L$withval/lib $LDFLAGS"], [])
124
125AC_SEARCH_LIBS(sqrt, m)
126AC_SEARCH_LIBS(ATL_ctrsv, atlas, [LIBS="-lcblas $LIBS"],
127               AC_SEARCH_LIBS(cblas_sdsdot, gslcblas))
128AC_SEARCH_LIBS(gsl_vector_alloc, gsl)
129
130CPP_TOOLS_LIBPATH="lib/c++_tools"
131AC_SUBST(CPP_TOOLS_LIBPATH)
132
133AC_CONFIG_FILES([Makefile
134                 base/Makefile
135                 base/base1/Makefile
136                 base/base1/base_plugin_script/Makefile
137                 base/base1/BaseFileConverter/Makefile
138                 base/base2/Makefile
139                 bin/Makefile
140                 bin/NNIFileConverter/Makefile
141                 bin/nni/Makefile
142                 data/Makefile
143                 lib/Makefile
144                 lib/c++_tools/Makefile
145                 lib/c++_tools/gslapi/Makefile
146                 lib/c++_tools/utility/Makefile
147                 test/Makefile])
148
149AC_OUTPUT
150
151# Some more messages.
152AC_MSG_NOTICE([])
153AC_MSG_NOTICE([ Ready to build WeNNI package containing])
154AC_MSG_NOTICE([])
155AC_MSG_NOTICE([     stand-alone binaries:])
156AC_MSG_NOTICE([         NNIFileConverter])
157AC_MSG_NOTICE([         nni])
158if (test x$state = xbase1); then
159  AC_MSG_NOTICE([     BASE1 plug-in:])
160  AC_MSG_NOTICE([         BaseFileConverter])
161  AC_MSG_NOTICE([         base_plugin_script])
162fi
163if (test x$state = xbase2); then
164  AC_MSG_NOTICE([     BASE2 plug-in:])
165  AC_MSG_NOTICE([         WeNNI.jar])
166fi
167AC_MSG_NOTICE([])
168AC_MSG_NOTICE([ WeNNI package will be installed in])
169AC_MSG_NOTICE([    $PLUGINDIR ])
170AC_MSG_NOTICE([])
171AC_MSG_NOTICE([ The following libs and flags will be used:])
172AC_MSG_NOTICE([ +++++++++++++++++++++++++++++++++++++++++++++++])
173AC_MSG_NOTICE([  CPPFLAGS    =\"$CPPFLAGS\"])
174AC_MSG_NOTICE([  CXXFLAGS    =\"$CXXFLAGS\"])
175AC_MSG_NOTICE([  LDFLAGS     =\"$LDFLAGS\"])
176AC_MSG_NOTICE([  LIBS        =\"$LIBS\"])
177if (test x$state = xbase1); then
178  AC_MSG_NOTICE([  BASECPPFLAGS=\"$BASECPPFLAGS\"])
179  AC_MSG_NOTICE([  BASELDFLAGS =\"$BASELDFLAGS\"])
180fi
181if (test x$state = xbase2); then
182  AC_MSG_NOTICE([  JAVACFLAGS=\"$JAVACFLAGS\"])
183fi
184AC_MSG_NOTICE([ +++++++++++++++++++++++++++++++++++++++++++++++])
185AC_MSG_NOTICE([])
186AC_MSG_NOTICE([ Now type 'make ; make check ; make install'.])
Note: See TracBrowser for help on using the repository browser.