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