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