2 # Process this file with autoconf to produce a configure script.
6 # Copyright (C) 2005, 2006 Dan McMahill
8 # This program is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 3 of the License, or
11 # (at your option) any later version.
13 # This program is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with this program; if not, write to the Free Software
20 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
24 AC_INIT([gnucap-uf],[0.0.2-rc10],[felix@salfelder.org])
28 AM_INIT_AUTOMAKE([-Wno-portability silent-rules])
34 AC_CONFIG_SRCDIR([src/main.cc])
35 AC_CONFIG_MACRO_DIR([m4])
36 AC_CONFIG_HEADERS([src/config.h])
39 # this will break Makefile dependencies (d'0h)
42 AC_PREFIX_DEFAULT("/usr/local")
44 # libdir_const="${prefix}/lib"
46 #sysconfdir='/bar/etc'
51 dnl ----------------- doc ------------------
52 AC_MSG_CHECKING([doc])
54 [ --enable-doc Enable building of modules. [[default: disabled]]],
56 if test "X$enable_doc" = "Xno" ; then
67 AC_OUTPUT([doc/Makefile])
68 AM_CONDITIONAL([DOC], [test x$enable_doc != xno] )
69 dnl ----------------- man ------------------
70 AC_MSG_CHECKING([man])
72 [ --enable-man Enable building of modules. [[default: disabled]]],
74 if test "X$enable_man" = "Xno" ; then
86 dnl ------------- modules -------------------
88 AC_MSG_CHECKING([if shared modules should be compiled and installed])
89 AC_ARG_ENABLE([modules],
90 [ --enable-modules Enable building of modules. [[default: disabled]]],
92 if test "X$enable_modules" = "Xno" ; then
103 AC_OUTPUT([modules/Makefile])
104 AM_CONDITIONAL([MODULES], [test x$enable_modules != xno] )
106 dnl ------------------- debugging -------------------
107 AC_MSG_CHECKING([if debug code should be compiled in])
108 AC_ARG_ENABLE([debug],
109 [ --enable-debug Enable building of debug code. [[default: disabled]]],
111 if test "X$enable_debug" = "Xno" ; then
123 # Checks for programs.
132 AC_CHECK_PROG(GIT,git,yes)
133 AC_MSG_CHECKING([for git repo])
134 AS_IF([test x"$GIT" = "xyes" && test -d $srcdir/.git],
137 AC_MSG_RESULT([$have_git_repo])
139 WHICH_MAKE=`which make`
140 AC_SUBST([WHICH_MAKE])
142 AH_TEMPLATE(HAVE_GIT_REPO, "whether this is built from git")
143 AH_TEMPLATE(GIT_BRANCH, "the current branch")
144 AH_TEMPLATE(GIT_TAG, "the description")
145 AH_TEMPLATE(GIT_COMMIT, "the commit id")
146 AH_TEMPLATE(GIT_COMMIT_SHORT, "the commit id short")
148 AM_CONDITIONAL([HAVE_GIT_REPO], [test yes = $have_git_repo])
149 AS_IF([test yes = $have_git_repo],
150 [AC_MSG_NOTICE([building from git])
151 git_commit=`git rev-parse HEAD`
152 git_commit_short=`git rev-parse --short HEAD`
153 git_tag=`git describe`
154 git_branch=`git rev-parse --abbrev-ref HEAD`
155 AC_DEFINE([HAVE_GIT_REPO],[1])
157 AC_DEFINE([HAVE_GIT_REPO],[0])
162 # AC_SUBST(GIT_COMMIT, $git_commit)
163 AC_SUBST(GIT_COMMIT_SHORT, $git_commit_short)
164 # AC_SUBST(GIT_BRANCH, $git_branch)
165 # AC_SUBST(GIT_TAG, $git_tag)
167 AM_CONDITIONAL([VPATH_BUILD], [test ! x$srcdir = "x."])
169 ac_script='s/\$\$/$/g;s/\\\\/\\/'
170 reverse=`$as_echo "$program_transform_name" | sed "$ac_script"`
171 GNUCAP_CPPFLAGS=-I$includedir/`echo gnucap | sed -e "$reverse"`
172 AC_SUBST([GNUCAP_CPPFLAGS])
174 # required by attach command
175 AH_TEMPLATE([GNUCAP_CPPFLAGS])
176 AC_DEFINE_UNQUOTED([GNUCAP_CPPFLAGS],["$GNUCAP_CPPFLAGS"])
178 # If we are cross compiling, then we need to search for a
179 # gnucap-modelgen program to use for our build. This can
180 # either be an installed modelgen or it can be specified
182 # env MODELGEN=/build/i686--linux/modelgen/gnucap-modelgen /srcs/gnucap/configure
183 # --host=alpha--netbsd --build=i686--linux
185 if test "$cross_compiling" = yes; then
186 AC_PATH_PROG(MODELGEN, gnucap-modelgen)
188 MODELGEN=../modelgen/gnucap-modelgen
192 # for building the documentation
193 #AC_PATH_PROG(DVIPDFM, dvipdfm, notfound)
194 #AM_CONDITIONAL(MISSING_DVIPDFM, test x$DVIPDFM = xnotfound)
195 #AC_PATH_PROG(HACHA, hacha, notfound)
196 #AC_PATH_PROG(HEVEA, hevea, notfound)
197 #AM_CONDITIONAL(MISSING_HEVEA, test x$HEVEA = xnotfound -o x$HACHA = xnotfound)
198 #AC_PATH_PROG(LATEX, latex, notfound)
199 #AC_PATH_PROG(MAKEINDEX, makeindex, notfound)
200 #AM_CONDITIONAL(MISSING_LATEX, test x$LATEX = xnotfound -o x$MAKEINDEX = xnotfound)
202 # Checks for libraries.
206 AC_CHECK_LIB([m], [cos])
209 AC_CHECK_LIB([gslcblas], [cblas_dgemv])
210 AC_CHECK_LIB([gsl], [gsl_blas_dgemm])
211 AC_CHECK_LIB([gsl], [gsl_fit_linear])
212 AC_CHECK_FUNCS([sqrt])
215 dnl ----------------------------------------------------
217 AC_CHECK_HEADERS([rfftw.h], [AC_DEFINE([HAVE_FFTW_H], [1],
218 [Define to 1 if you have fftw])
222 # fixme: complain if HAVE_FFTW
223 AC_CHECK_LIB([fftw], [fftw_create_plan], LIBS="$LIBS -lfftw")
224 AC_CHECK_LIB([rfftw], [rfftw_create_plan], LIBS="-lrfftw $LIBS")
226 dnl ----------------------------------------------------
227 # some more checks. some should depend on switches. but the switches arent
230 AC_CHECK_HEADER([atlas/clapack.h],
231 [AC_DEFINE([HAVE_CLAPACK_H], [1],
232 [Define to 1 if you have atlas/clapack.h])
234 [AC_MSG_NOTICE([please install package libatlas-dev])])
235 AM_CONDITIONAL([USE_ATLAS], [test $HAVE_CLAPACK_H -eq 1])
238 AC_CHECK_LIB([lapack], [dgelss_],
239 [LAPACK_LIBS="-llapack"
240 AC_DEFINE([HAVE_LIBLAPACK], [1], [Define to 1 if there is liblapack])])
241 AC_SUBST([LAPACK_LIBS])
243 AC_CHECK_HEADER([boost/algorithm/string.hpp],
244 [AC_DEFINE([HAVE_STRING_HPP], [1],
245 [Define to 1 if there is boost/algorithm/string.hpp])],
246 [AC_MSG_NOTICE([please install the boost package])])
248 # fixme: refine a bit?
250 AC_CHECK_HEADERS([boost/assign.hpp],
252 AC_DEFINE([HAVE_BOOST], [1], [have boost])
254 [AC_MSG_NOTICE(You need the Boost libraries.)
257 AC_CHECK_HEADER([boost/algorithm/string/split.hpp],
258 [AC_DEFINE([HAVE_SPLIT_HPP], [1],
259 [Define to 1 if there is boost/algorithm/string/split.hpp])],
260 [AC_MSG_NOTICE([please install the boost package])])
262 AC_CHECK_HEADER([readline/readline.h],
263 [AC_DEFINE([HAVE_READLINE_H], [1],
264 [Define to 1 if you have readline/readline.h])],
265 [AC_MSG_ERROR([please install the libreadline-dev package])])
267 AC_CHECK_HEADER([readline/history.h],
268 [AC_DEFINE([HAVE_HISTORY_H], [1],
269 [Define to 1 if you have readline/history.h])],
270 [AC_MSG_ERROR([please install the libreadline-dev package])])
274 [AS_HELP_STRING([--with-gsl],
275 [support gsl @<:@default=yes@:>@])],
280 if test "x$with_gsl" != xno ; then
281 AC_CHECK_HEADER([gsl/gsl_fit.h],
282 [AC_DEFINE([HAVE_GSL_FIT_H], [1],
283 [Define to 1 if you have gsl/gsl_fit.h])
286 [AC_MSG_NOTICE([consider installing the libgsl0-dev package])])
288 AM_CONDITIONAL([USE_GSL], [test $HAVE_GSL_H -eq 1])
290 AC_ARG_WITH([readline],
291 [AS_HELP_STRING([--with-readline],
292 [support command line editing @<:@default=yes@:>@])],
296 if test "x$with_readline" != xno ; then
297 AC_CHECK_LIB([termcap], [main])
298 AC_CHECK_LIB([readline], [main])
301 AC_CHECK_LIB([dl], [dlopen])
303 # LT_INIT([static shared])
309 # Checks for header files.
310 #AC_CHECK_HEADERS([fcntl.h unistd.h])
312 AC_CHECK_HEADERS([boost/assign.hpp], [],
313 [AC_MSG_ERROR(You need the Boost libraries.)])
315 # Checks for typedefs, structures, and compiler characteristics.
317 # Checks for library functions.
319 if test "$enable_debug" = "yes" ; then
320 CPPFLAGS="$CPPFLAGS -DTRACE_UNTESTED"
322 CPPFLAGS="$CPPFLAGS -DNDEBUG"
326 -W -Wno-sign-compare \
327 -Wpointer-arith -Wcast-qual \
328 -Wwrite-strings -Wconversion \
329 -Woverloaded-virtual -O2 -Wlong-long \
330 -Wsign-compare -Wcast-align"
332 # if we have gcc and we've asked for debugging then add lots of -W
333 if test "x$GCC" = "xyes" -a "$enable_debug" = "yes"; then
334 for flag in -DTRACE_UNTESTED -Wall -W -Wno-sign-compare \
335 -Wpointer-arith -Wcast-qual \
336 -Wwrite-strings -Wconversion \
337 -Woverloaded-virtual -O2 -Wlong-long \
338 -Wsign-compare -Wcast-align ; do
339 case " ${CFLAGS} " in
341 # flag is already present
344 CFLAGS="$CFLAGS ${flag}"
347 case " ${CXXFLAGS} " in
349 # flag is already present
352 CXXFLAGS="$CXXFLAGS ${flag}"
357 # remove additional added -OX
360 for flag in ${CXXFLAGS} ; do
361 case " -O0 -O1 -O2 -O3 " in
363 if test "${FOUNDOX}" = "no"; then
364 NEWCXXFLAGS="${NEWCXXFLAGS} ${flag}"
369 NEWCXXFLAGS="${NEWCXXFLAGS} ${flag}"
373 CXXFLAGS=${NEWCXXFLAGS}
374 # echo "CXXFLAGS: ${CXXFLAGS}"
377 for flag in ${CFLAGS} ; do
378 case " -O0 -O1 -O2 -O3 " in
380 if test "${FOUNDOX}" = "no"; then
381 NEWCFLAGS="${NEWCFLAGS} ${flag}"
386 NEWCFLAGS="${NEWCFLAGS} ${flag}"
391 # echo "CFLAGS: ${CFLAGS}"
395 # exports symbols to plugins
396 LDFLAGS="$LDFLAGS -rdynamic"
398 # stupid hack (needed?)
399 if test "x${prefix}" = "xNONE"; then
400 AC_DEFINE_UNQUOTED( PREFIX, "${ac_default_prefix}", "Prefix")
401 AC_DEFINE_UNQUOTED( LIBDIR, "${ac_default_prefix}/lib", "Libdir")
402 AC_DEFINE_UNQUOTED( SODIR, "${ac_default_prefix}/lib", "Sodir")
404 AC_DEFINE_UNQUOTED( PREFIX, "${prefix}", "Prefix")
405 AC_DEFINE_UNQUOTED( LIBDIR, "${prefix}/lib", "Libdir")
406 AC_DEFINE_UNQUOTED( SODIR, "${prefix}/lib", "Sodir")
410 #if test "X$enable_man" = "Xyes"; then
413 #man/Addmodel/Makefile
414 #man/Behavior/Makefile
415 #man/Circuit/Makefile
416 #man/Commands/Makefile
421 # workaround, as we don't want to know the names literally
423 for i in `shopt -s nullglob; echo extern/*`; do
424 AS_IF([test -d $i -a -x $i/configure], [subdirs="$subdirs $i"])
432 # man/Addmodel/Makefile
433 # man/Behavior/Makefile
434 # man/Circuit/Makefile
435 # man/Commands/Makefile
441 AC_CONFIG_FILES([main/gnucap-conf], [chmod +x main/gnucap-conf])
442 AC_CONFIG_FILES([main/gnucap.mk], [chmod +x main/gnucap.mk])
443 AC_CONFIG_FILES([src/gnucap], [chmod +x src/gnucap])
457 plugindir=$libdir/$package
460 ** Configuration summary for $PACKAGE $VERSION:
463 suffix: $program_suffix
464 exec_prefix:$exec_prefix
465 plugindir: $plugindir
473 modules: $enable_modules
474 shared_lib: $enable_lib
479 git repo: $have_git_repo