1 # This file is part of Autoconf. -*- Autoconf -*-
3 # ViennaRNA Package 2011 Ronny Lorenz
10 AC_DEFUN([AC_RNA_TEST_FILE],[
11 AC_MSG_CHECKING([for $1])
21 AC_DEFUN([AC_RNA_PACKAGE_IF_ENABLED],[
22 if test "x$with_$1" != xno; then
28 # AC_RNA_ADD_PACKAGE( package-name,
29 # package-description,
31 # [action-if-not-default],
32 # [action-if-default],
33 # [files to check for])
35 # This macro handles additional package inclusion
37 # package-name: a lowercase name of the optional package
38 # which is used for $with_package_name variables
39 # and --with[out]-package-name options in
41 # The package_name must consist of alphanumeric
42 # characters including the dash only! Every
43 # occuring dash will be replaced by a '-' char
44 # in the --with[out]-package-name option
46 # package-desciption: a very brief description used for the package
47 # specific help output in configure script
49 # default-on: package build | installed by default
50 # Values: "yes" or "no"
52 # Example: AC_RNA_ADD_PACKAGE([foo], [the incredible Foo program], [yes], [with_foo=no], [with_foo=yes], [file1 file2])
55 AC_DEFUN([AC_RNA_ADD_PACKAGE],[
57 # announce the option to include it in configure script
58 AC_ARG_WITH(m4_translit([[$1]], [_], [-]),
60 [AS_HELP_STRING([--without-m4_translit([$1], [_], [-])], [do not build | install $2])],
61 [AS_HELP_STRING([--with-m4_translit([$1], [_], [-])], [build | install $2])])],
65 # check if enabling the package makes sense at configure-time
66 # and deactivate it if not
68 AC_RNA_PACKAGE_IF_ENABLED([$1],[
70 AC_RNA_TEST_FILE([$i],
79 # AC_RNA_DOCUMENTATION_INIT(PROJECT_NAME, [config-file], [documentation-output-directory])
82 AC_DEFUN([AC_RNA_DOCUMENTATION_INIT],[
84 AC_PATH_PROG(doxygen, [doxygen],no)
85 AC_PATH_PROG(pdflatex,[pdflatex],no)
86 AC_PATH_PROG(latex,[latex],no)
87 AC_PATH_PROG(makeindex,[makeindex],no)
88 AC_PATH_PROG(dot,[dot],no)
89 AC_PATH_PROG(egrep,[egrep],no)
90 AC_PATH_PROG(perl,[perl],no)
92 DOXYGEN_PDFLATEX_WORKARROUND=yes
94 # check whether we are able to generate the doxygen documentation
95 AC_RNA_PACKAGE_IF_ENABLED([doc],[
96 if test "x$doxygen" != xno;
98 # test for programs necessary in order to use doxygen
100 if test "x$DOXYGEN_PDFLATEX_WORKARROUND" = xno;
102 # this is a workarround for older versions of doxygen as installed e.g. in fc12 where
103 # pdflatex usage does not work
105 if test "x$pdflatex" = xno;
107 if test "x$latex" = xno;
109 AC_MSG_WARN([neither latex or pdflatex exists on your system!])
110 AC_MSG_WARN([deactivating automatic (re)generation of reference manual!])
119 if test "x$latex" = xno;
121 AC_MSG_WARN([neither latex or pdflatex exists on your system!])
122 AC_MSG_WARN([deactivating automatic (re)generation of reference manual!])
126 AC_MSG_WARN([due to a bug in older versions of doxygen, latex will be used for reference manual generation even if pdflatex is available])
132 if test "x$makeindex" = xno;
134 AC_MSG_WARN([makeindex command not found on your system!])
135 AC_MSG_WARN([deactivating automatic (re)generation of reference manual!])
139 if test "x$egrep" = xno;
141 AC_MSG_WARN([egrep command not found on your system!])
142 AC_MSG_WARN([deactivating automatic (re)generation of reference manual!])
146 if test "x$dot" = xno;
148 AC_MSG_WARN([dot command not found on your system!])
149 AC_MSG_WARN([deactivating graph output in reference manual!])
152 if test "x$perl" = xno;
154 AC_MSG_WARN([perl command not found on your system!])
155 AC_MSG_WARN([deactivating automatic (re)generation of reference manual!])
163 # setup everything in order to generate the doxygen configfile
165 AC_RNA_PACKAGE_IF_ENABLED([doc],[
167 AC_SUBST([DOXYGEN_PROJECT_NAME], [$1-$PACKAGE_VERSION])
168 AC_SUBST([DOXYGEN_SRCDIR], [$srcdir])
169 AC_SUBST([DOXYGEN_DOCDIR], [ifelse([$3], [], [doc], [$3])])
170 AC_SUBST([DOXYGEN_CONF], [ifelse([$2], [], [doxygen.conf], [$2])])
173 # prepare the config file for doxygen if we are able to generate a reference manual
174 if test "x$doxygen" != xno;
177 AC_SUBST([DOXYGEN_CMD_LATEX], [$_latex_cmd])
178 AC_SUBST([DOXYGEN_CMD_MAKEINDEX], [$makeindex])
179 AC_SUBST([DOXYGEN_HAVE_DOT],[ifelse([$dot], [no], [NO], [YES])])
180 AC_SUBST([DOXYGEN_WITH_PDFLATEX], [ifelse([$pdflatex],[no],[NO],[YES])])
181 AC_SUBST([DOXYGEN_GENERATE_HTML], [ifelse([$with_doc_html], [no], [NO], [YES])])
182 AC_SUBST([DOXYGEN_GENERATE_LATEX], [ifelse([$with_doc_pdf], [no], [NO], [YES])])
184 AC_CONFIG_FILES([${DOXYGEN_DOCDIR}/${DOXYGEN_CONF}])
188 # otherwise check if a generated reference manual already exists
190 AC_RNA_PACKAGE_IF_ENABLED([doc_pdf],[
191 AC_RNA_TEST_FILE( [$DOXYGEN_DOCDIR/$DOXYGEN_PROJECT_NAME.pdf],
195 AC_RNA_PACKAGE_IF_ENABLED([doc_html],[
196 AC_RNA_TEST_FILE( [$DOXYGEN_DOCDIR/html/index.html],
198 [with_doc_html=no])])
200 if test "x$with_doc_pdf" = "x$with_doc_html";
202 if test "x$with_doc_pdf" = xno;
210 AC_SUBST([REFERENCE_MANUAL_PDF_NAME], [ifelse([$with_doc_pdf],
213 [$DOXYGEN_PROJECT_NAME.pdf])])
214 AC_SUBST([REFERENCE_MANUAL_TAGFILE], [ifelse([$doxygen],
217 [$DOXYGEN_PROJECT_NAME.tag])])
220 # setup variables used in Makefile.am
221 AM_CONDITIONAL(WITH_REFERENCE_MANUAL, test "x$with_doc" != xno)
222 AM_CONDITIONAL(WITH_REFERENCE_MANUAL_BUILD, test "x$doxygen" != xno)
223 AM_CONDITIONAL(WITH_REFERENCE_MANUAL_PDF, test "x$with_doc_pdf" != xno)
224 AM_CONDITIONAL(WITH_REFERENCE_MANUAL_HTML, test "x$with_doc_html" != xno)
232 AC_DEFUN([AC_RNA_INIT],[
237 dnl add packages to the configure process
239 AC_RNA_ADD_PACKAGE( [perl],
244 [interfaces/Perl/Makefile.am])
245 AC_RNA_ADD_PACKAGE( [python],
250 [interfaces/Python/Makefile.am])
251 AC_RNA_ADD_PACKAGE( [ruby],
256 [interfaces/Ruby/Makefile.am])
257 AC_RNA_ADD_PACKAGE( [kinfold],
262 [Kinfold/Makefile.am])
263 AC_RNA_ADD_PACKAGE( [forester],
264 [RNAforester program],
268 [RNAforester/Makefile.am])
269 AC_RNA_ADD_PACKAGE( [cluster],
270 [AnalyseSeqs and AnalyseDists],
274 [Cluster/Makefile.am])
275 AC_RNA_ADD_PACKAGE( [svm],
280 [libsvm-${SVM_VERSION}/svm.cpp libsvm-${SVM_VERSION}/svm.h])
281 AC_RNA_ADD_PACKAGE( [doc_pdf],
282 [PDF RNAlib reference manual],
286 AC_RNA_ADD_PACKAGE( [doc_html],
287 [HTML RNAlib reference manual],
291 AC_RNA_ADD_PACKAGE( [doc],
292 [RNAlib reference manual],
299 ## begin with initialization according to configure-time specific options
301 ## The following test ensures the right type for FLT_OR_DBL in the SWIG RNAlib interface
302 AC_MSG_CHECKING([whether float precision is used for partition function arrays instead of double precision])
303 bla=`${GREP} "^#define LARGE_PF" H/data_structures.h`
304 if test "x$bla" = "x";
308 AC_MSG_RESULT([$with_pf_float])
310 # check prerequisites for Perl interface
311 AC_PATH_PROG(PerlCmd, perl)
312 ifelse([$PerlCmd], [],[
313 AC_MSG_WARN([No suitable Perl found -- will not build Perl module])
314 AC_MSG_WARN([You may set the PerlCmd environment variable to point to
315 a suitable perl binary])
318 if $PerlCmd -e 'require 5.004'; then :
320 AC_MSG_WARN([You need Perl version 5.004 or higher for the Perl module])
326 # prepare all files for perl interface
327 AC_RNA_PACKAGE_IF_ENABLED([perl],[
328 AC_DEFINE([WITH_PERL_INTERFACE], [1], [Create the perl interface to RNAlib])
329 AC_SUBST([PERL_INTERFACE], [Perl])
330 AC_CONFIG_FILES([interfaces/Perl/Makefile interfaces/Perl/Makefile.PL])
333 # check prerequisites for Python interface
334 AC_PATH_PROG(PythonCmd, python)
335 ifelse([$PythonCmd], [], [
336 AC_MSG_WARN([No suitable Python found -- will not build Python extension])
337 AC_MSG_WARN([You may set the PythonCmd environment variable to point to
338 a suitable python binary])
341 version_test=`$PythonCmd interfaces/Python/version_test.py`
342 if test "x$version_test" = "xok"; then :
344 AC_MSG_WARN([You need Python >= 2.5 and < 3.0 to build the Python extension])
345 AC_MSG_WARN([You may set the PythonCmd environment variable to point to
346 a suitable python binary])
351 # prepare all files for python interface
352 AC_RNA_PACKAGE_IF_ENABLED([python],[
353 AC_DEFINE([WITH_PYTHON_INTERFACE], [1], [Create the python interface to RNAlib])
354 AC_SUBST([PYTHON_INTERFACE], [Python])
355 AC_CONFIG_FILES([interfaces/Python/Makefile interfaces/Python/setup.py])
359 AC_RNA_PACKAGE_IF_ENABLED([kinfold],[
360 AC_CONFIG_SUBDIRS([Kinfold])
363 AC_RNA_PACKAGE_IF_ENABLED([forester],[
364 AC_CONFIG_SUBDIRS([RNAforester])
367 AC_RNA_PACKAGE_IF_ENABLED([cluster],[
368 AC_DEFINE([WITH_CLUSTER], [1], [Analyse{Dists,Seqs}])
369 AC_SUBST([CLUSTER_DIR], [Cluster])
370 AC_CONFIG_FILES([Cluster/Makefile])
373 AC_RNA_PACKAGE_IF_ENABLED([svm],[
374 AC_SUBST([LIBSVM_DIR], [libsvm-${SVM_VERSION}])
375 AC_SUBST([CXXLD],[${CXX}]) # this is rather a hack for RNALfold.c linking correctly
376 AC_DEFINE([USE_SVM], [1], [Compute z-scores for RNALfold])
379 AM_CONDITIONAL(WITH_LARGE_PF, test "$with_pf_float" != "yes")
380 AM_CONDITIONAL(MAKE_KINFOLD, test "$with_kinfold" != "no")
381 AM_CONDITIONAL(MAKE_FORESTER, test "$with_forester" != "no")
382 AM_CONDITIONAL(MAKE_CLUSTER, test "$with_cluster" = "yes")
383 AM_CONDITIONAL(WITH_LIBSVM, test "$with_svm" != "no")
385 AC_RNA_DOCUMENTATION_INIT([RNAlib])
387 AC_CONFIG_FILES([misc/Makefile misc/ViennaRNA.spec misc/PKGBUILD])
388 AC_CONFIG_FILES([interfaces/Makefile])
389 AC_CONFIG_FILES([Makefile RNAlib2.pc Utils/Makefile Progs/Makefile lib/Makefile man/Makefile H/Makefile doc/Makefile])
391 AC_CONFIG_FILES([man/cmdlopt.sh],[chmod +x man/cmdlopt.sh])
395 AC_DEFUN([AC_RNA_NOTICE],[
397 # get directory paths
399 eval _bindir=$(eval printf "%s" $bindir)
400 eval _libdir=$(eval printf "%s" $libdir)
401 eval _includedir=$(eval printf "%s" $includedir)
402 eval _datadir=$(eval printf "%s" $datadir)
403 eval _mandir=$(eval printf "%s" $mandir)
404 eval _docdir=$(eval printf "%s" $docdir)
405 eval _htmldir=$(eval printf "%s" $htmldir)
406 eval _pdfdir=$(eval printf "%s" $pdfdir)
412 Configure successful with the following options:
415 Perl Interface: ${with_perl:-yes}
416 Python Interface: ${with_python:-yes}
417 Ruby Interface: ${with_ruby:-yes}
420 Analyse{Dists,Seqs}: ${with_cluster:-no}
421 Kinfold: ${with_kinfold:-yes}
422 RNAforester: ${with_forester:-yes}
425 SVM: ${with_svm:-yes}
426 Documentation: ${with_doc:-no}
427 (HTML): ${with_doc_html:-no}
428 (PDF): ${with_doc_pdf:-no}
430 Files will be installed in the following directories:
432 Executables: $_bindir
434 Header files: $_includedir
435 Extra Data: $_datadir
437 Documentation: $_docdir
438 (HTML): $(eval printf "%s" $_htmldir)/html
439 (PDF): $(eval printf "%s" $_pdfdir)