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

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

avoid setting CPPFLAGS and friends in configure.ac
and updating Makefile.ams accordingly

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 6.9 KB
Line 
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
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
57AM_CXXFLAGS="-Wall -pedantic"
58AM_CPPFLAGS="-DHAVE_INLINE=1"
59AC_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
66AC_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
77Unknown value for `--enable-state'
78allowed values are: `base2', `base1', or `stand-alone'])
79                fi ],
80              [ state="base2" ])
81
82AM_CONDITIONAL([BASE1], [test x$state = xbase1])
83AM_CONDITIONAL([BASE2], [test x$state = xbase2])
84
85AC_ARG_WITH(basedir,[AS_HELP_STRING([--with-basedir=DIR]),
86                     [root directory for base installation])],
87            [BASEDIR=$withval],[BASEDIR=/usr/local/base])
88
89AC_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
98if (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])
116fi
117if (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)
125fi
126
127AC_SEARCH_LIBS([sqrt], [m],, AC_MSG_FAILURE([cannot find math library]))
128AC_SEARCH_LIBS([ATL_ctrsv], [atlas],,
129               AC_SEARCH_LIBS(cblas_sdsdot, gslcblas,,
130                        AC_MSG_FAILURE([cannot find cblas library])))
131
132save_LDFLAGS="$LDFLAGS"
133AC_ARG_WITH(gsl,[AS_HELP_STRING([--with-gsl=DIR], [prefix for gsl files])],
134            [GSL_CPPFLAGS="-I$withval/include"; GSL_LDFLAGS="-L$withval/lib"])
135LDFLAGS="$LDFLAGS $GSL_LDFLAGS"
136AC_SEARCH_LIBS([gsl_vector_alloc], [gsl],,
137               AC_MSG_FAILURE([cannot find library GSL]))
138LDFLAGS="$save_LDFLAGS"
139
140AC_SUBST(GSL_LDFLAGS)
141AM_CPPFLAGS="-I\$(top_srcdir)/lib $GSL_CPPFLAGS $AM_CPPFLAGS"
142AC_SUBST(AM_CPPFLAGS)
143AC_SUBST(AM_CXXFLAGS)
144
145CPP_TOOLS_LIBPATH="lib/c++_tools"
146AC_SUBST(CPP_TOOLS_LIBPATH)
147
148AC_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
164AC_OUTPUT
165
166# Some more messages.
167AC_MSG_NOTICE([])
168AC_MSG_NOTICE([ Ready to build WeNNI package containing])
169AC_MSG_NOTICE([])
170AC_MSG_NOTICE([     stand-alone binaries:])
171AC_MSG_NOTICE([         NNIFileConverter])
172AC_MSG_NOTICE([         nni])
173if (test x$state = xbase1); then
174  AC_MSG_NOTICE([     BASE1 plug-in:])
175  AC_MSG_NOTICE([         BaseFileConverter])
176  AC_MSG_NOTICE([         base_plugin_script])
177fi
178if (test x$state = xbase2); then
179  AC_MSG_NOTICE([     BASE2 plug-in:])
180  AC_MSG_NOTICE([         WeNNI.jar])
181fi
182AC_MSG_NOTICE([])
183AC_MSG_NOTICE([ WeNNI package will be installed in])
184AC_MSG_NOTICE([    $PLUGINDIR ])
185AC_MSG_NOTICE([])
186AC_MSG_NOTICE([ The following libs and flags will be used:])
187AC_MSG_NOTICE([ +++++++++++++++++++++++++++++++++++++++++++++++])
188AC_MSG_NOTICE([  CPPFLAGS    =\"$CPPFLAGS\"])
189AC_MSG_NOTICE([  CXXFLAGS    =\"$CXXFLAGS\"])
190AC_MSG_NOTICE([  LDFLAGS     =\"$LDFLAGS\"])
191AC_MSG_NOTICE([  LIBS        =\"$LIBS\"])
192if (test x$state = xbase1); then
193  AC_MSG_NOTICE([  BASECPPFLAGS=\"$BASECPPFLAGS\"])
194  AC_MSG_NOTICE([  BASELDFLAGS =\"$BASELDFLAGS\"])
195fi
196if (test x$state = xbase2); then
197  AC_MSG_NOTICE([  JAVACFLAGS=\"$JAVACFLAGS\"])
198fi
199AC_MSG_NOTICE([ +++++++++++++++++++++++++++++++++++++++++++++++])
200AC_MSG_NOTICE([])
201AC_MSG_NOTICE([ Now type 'make ; make check ; make install'.])
Note: See TracBrowser for help on using the repository browser.