source: trunk/configure.ac @ 334

Last change on this file since 334 was 334, checked in by kulshres, 8 years ago

correct help text for --with-colpack flag

Signed-off-by: Kshitij Kulshreshtha <kshitij@…>

  • Property svn:keywords set to Author Date Id Revision
File size: 17.5 KB
Line 
1##############################################################################
2# configure.ac -- Process this file with autoconf to produce configure
3# Revision: $Id: configure.ac 334 2012-08-06 15:02:30Z kulshres $
4#
5# Copyright (C) Andrea Walther, Andreas Kowarz
6#               
7# contains patches from the COIN OR libtool
8#
9##############################################################################
10define([ADOLC_VER], [2])
11define([ADOLC_SUB], [3])
12define([ADOLC_LVL], [0])
13
14AC_PREREQ(2.67)
15AC_INIT(adolc,
16        ADOLC_VER.ADOLC_SUB.ADOLC_LVL-trunk,
17        [adol-c@list.coin-or.org])
18AC_REVISION($Revision: 334 $)
19AC_CONFIG_SRCDIR([ADOL-C/src/adolc.h])
20AC_CONFIG_AUX_DIR(autoconf)
21AC_CONFIG_HEADERS([ADOL-C/src/config.h])
22AC_PREFIX_DEFAULT(${HOME}/adolc_base)
23AM_INIT_AUTOMAKE([1.11 dist-bzip2 foreign])
24AM_SILENT_RULES([yes])
25
26if test "x$CFLAGS" == x ; then
27    ac_shell_cflags="not_set"
28else
29    ac_shell_cflags="$CFLAGS"
30fi
31if test "x$CXXFLAGS" == x ; then
32    ac_shell_cxxflags="not_set"
33else
34    ac_shell_cxxflags="$CXXFLAGS"
35fi
36
37# checks for programs
38AC_PROG_CXX
39AC_PROG_CC
40AC_PROG_CPP
41AC_PROG_INSTALL
42AC_PROG_LN_S
43AC_PROG_MAKE_SET
44AC_LIBTOOL_WIN32_DLL
45AC_PROG_LIBTOOL
46
47AC_CHECK_SIZEOF([void *])
48if test "x$ac_cv_sizeof_void_p" = "x8" ; then
49   _lib=lib64
50else
51   _lib=lib
52fi
53libdir='${exec_prefix}/${_lib}'
54AC_SUBST(_lib)
55AC_SUBST(libdir)
56
57# checks for header files
58AC_HEADER_STDC
59AC_HEADER_TIME
60AC_HEADER_STDBOOL
61AC_CHECK_HEADERS([stddef.h stdlib.h stdio.h string.h unistd.h sys/timeb.h])
62
63# checks for types
64AC_C_CONST
65AC_C_INLINE
66AC_TYPE_SIZE_T
67AC_STRUCT_TM
68
69# Checks for library functions
70AC_FUNC_MALLOC
71AC_FUNC_REALLOC
72
73# Checks for libraries and fuctions
74AC_SEARCH_LIBS([pow], [m])
75AC_CHECK_FUNCS([floor fmax fmin ftime pow sqrt strchr strtol trunc])
76
77# substitutions
78AC_SUBST(ac_aux_dir)
79
80# ADOL-C configuration
81AC_DEFINE(ADOLC_VERSION,ADOLC_VER,[ADOL-C Version])
82AC_DEFINE(ADOLC_SUBVERSION,ADOLC_SUB,[ADOL-C Subversion])
83AC_DEFINE(ADOLC_PATCHLEVEL,ADOLC_LVL,[ADOL-C Patchlevel])
84ADOLC_VERSION=ADOLC_VER
85ADOLC_SUBVERSION=ADOLC_SUB
86ADOLC_PATCHLEVEL=ADOLC_LVL
87AC_SUBST(ADOLC_VERSION)
88AC_SUBST(ADOLC_SUBVERSION)
89AC_SUBST(ADOLC_PATCHLEVEL)
90
91AC_MSG_CHECKING(whether to use ADOL-C debug mode)
92AC_ARG_ENABLE(debug,
93              [
94AS_HELP_STRING([--enable-debug],[enable ADOL-C debug mode [default=no]])],
95  [
96  adolc_debug=$enableval
97   AC_MSG_RESULT($adolc_debug)
98   ],
99  [
100   adolc_debug=no
101   AC_MSG_RESULT(no)
102   ])
103
104AC_MSG_CHECKING(whether to use ADOL-C hard debug mode)
105AC_ARG_ENABLE(harddebug,
106              [
107AS_HELP_STRING([--enable-harddebug],[enable ADOL-C hard debug mode
108 [default=no]])],
109  [
110   adolc_harddebug=$enableval
111   AC_MSG_RESULT($adolc_harddebug)
112   ],
113  [
114   adolc_harddebug=no
115   AC_MSG_RESULT(no)
116   ])
117
118if test x$adolc_harddebug == xyes ; then
119adolc_debug=yes
120AC_DEFINE(ADOLC_HARDDEBUG,1,[ADOL-C hard debug mode])
121fi
122
123if test x$adolc_debug == xyes ; then
124AC_DEFINE(ADOLC_DEBUG,1,[ADOL-C debug mode])
125fi
126
127AC_MSG_CHECKING(whether standard adouble constructor shall zero value)
128AC_ARG_ENABLE(stdczero,
129              [
130AS_HELP_STRING([--enable-stdczero],[adouble standard constructor zeros value
131(at the cost of performance) [default=no]])],
132  [
133  adolc_stdczero=$enableval
134  AC_MSG_RESULT($adolc_stdczero)
135  ],
136  [
137  adolc_stdczero=no
138  AC_MSG_RESULT(no)
139  ])
140
141if test x$adolc_stdczero == xyes ; then
142AC_DEFINE(ADOLC_ADOUBLE_STDCZERO,1,[ADOL-C adouble zeroing mode])
143fi
144
145AC_MSG_CHECKING(whether errno is thread save)
146AC_ARG_ENABLE(tserrno,
147              [
148AS_HELP_STRING([--enable-tserrno],[use errno as thread number cache [default=no]])],
149  [
150  adolc_tserrno=$enableval
151  AC_MSG_RESULT($adolc_tserrno)
152   ],
153  [
154  adolc_tserrno=no
155  AC_MSG_RESULT(no)
156  ])
157
158if test x$adolc_tserrno == xyes ; then
159AC_DEFINE(ADOLC_THREADSAVE_ERRNO,1,[ADOL-C thread save errno mode])
160fi
161
162AC_MSG_CHECKING(whether external function call forces backup of all adoubles)
163AC_ARG_ENABLE(safe_extern,
164              [
165AS_HELP_STRING([--enable-safe-extern],[backup all adoubles before calling an external function [default=no]])],
166  [
167  adolc_safe_extern=$enableval
168  AC_MSG_RESULT($adolc_safe_extern)
169  ],
170  [
171  adolc_safe_extern=no
172  AC_MSG_RESULT(no)
173  ])
174
175if test x$adolc_safe_extern == xyes ; then
176AC_DEFINE(ADOLC_SAFE_EXTERN,1,[ADOL-C safe extern mode])
177fi
178
179AC_MSG_CHECKING(which flag to use to enable OpenMP)
180AC_ARG_WITH(openmp-flag,
181            [AS_HELP_STRING([--with-openmp-flag=FLAG],
182                            [use FLAG to enable OpenMP at compile time [default=none]])],
183            [ac_adolc_openmpflag=$withval
184             AC_MSG_RESULT($ac_adolc_openmpflag)],
185            [ac_adolc_openmpflag=""
186             AC_MSG_RESULT(none)])
187
188
189# ADOL-C Sparse facility
190AC_MSG_CHECKING(whether to build sparse drivers)
191AC_ARG_ENABLE(sparse,
192            [
193AS_HELP_STRING([--enable-sparse],[build sparse drivers [default=disabled]])],
194            [sparse=$enableval
195             AC_MSG_RESULT($sparse)],
196            [sparse="no"
197             AC_MSG_RESULT(no)])
198
199AC_ARG_WITH(colpack,
200        [
201AS_HELP_STRING([--with-colpack=DIR],[path to the colpack library and headers [default=system libraries])],
202[
203colpack=$withval
204COLPACK_CFLAGS="$ac_adolc_openmpflag -I$colpack/include"
205COLPACK_LIBDIR="$colpack/${_lib}"
206COLPACK_LIBS="$ac_adolc_openmpflag -L$COLPACK_LIBDIR -lColPack"
207],
208[
209COLPACK_CFLAGS="$ac_adolc_openmpflag"
210COLPACK_LIBDIR=""
211COLPACK_LIBS="-lColPack"
212])
213
214AC_LANG_PUSH([C++])
215save_CPPFLAGS="$CPPFLAGS"
216save_LIBS="$LIBS"
217CPPFLAGS="$CPPFLAGS $COLPACK_CFLAGS"
218LIBS="$COLPACK_LIBS $LIBS"
219AC_MSG_CHECKING(for ColPack in $COLPACK_LIBDIR)
220AC_CHECK_HEADER([ColPack/ColPackHeaders.h],[have_colpackheaders=yes],[have_colpackheaders=no])
221if test x$have_colpackheaders = xyes ; then
222   AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <ColPack/ColPackHeaders.h>],
223                        [ColPack::GraphColoring g])],
224                       [have_colpack=yes
225                        AC_MSG_RESULT(linking with -lColPack succeeded)],
226                       [have_colpack=no,
227                        AC_MSG_RESULT(linking with -lColPack failed)])
228else
229    have_colpack=no
230fi
231CPPFLAGS="$save_CPPFLAGS"
232LIBS="$save_LIBS"
233AC_LANG_POP([C++])
234
235AM_CONDITIONAL(HAVE_LIBCOLPACK,[test x$have_colpack = xyes])
236if test x$have_colpack = xyes; then
237   sparse=yes
238   echo "will build sparse drivers as linking with -lColPack succeeded"
239fi
240AM_CONDITIONAL(SPARSE,[test x${sparse} = xyes])
241
242if test x$sparse = xyes && test x$have_colpack = xyes; then
243        AC_DEFINE(HAVE_LIBCOLPACK,[1],[Define 1 if ColPack is available])
244else
245        COLPACK_CFLAGS=""
246        COLPACK_LIBS=""
247fi
248AC_SUBST(COLPACK_CFLAGS)
249AC_SUBST(COLPACK_LIBS)
250
251# ADOL-C Examples
252AC_MSG_CHECKING(whether to build documented examples)
253AC_ARG_ENABLE(docexa,
254            [
255AS_HELP_STRING([--enable-docexa],[build documented examples [default=disabled]])],
256            [docexa=$enableval
257             AC_MSG_RESULT(yes)],
258            [docexa="no"
259             AC_MSG_RESULT(no)])
260AM_CONDITIONAL(DOCEXA,[test x${docexa} = xyes])
261
262AC_MSG_CHECKING(whether to build additional examples)
263AC_ARG_ENABLE(addexa,
264            [AS_HELP_STRING([--enable-addexa],
265                            [build additional examples [default=disabled]])],
266            [addexa=$enableval
267             AC_MSG_RESULT(yes)],
268            [addexa="no"
269             AC_MSG_RESULT(no)])
270AM_CONDITIONAL(ADDEXA,[test x${addexa} = xyes])
271
272AC_MSG_CHECKING(whether to build parallel example)
273AC_ARG_ENABLE(parexa,
274            [AS_HELP_STRING([--enable-parexa],
275                            [build parallel example [default=disabled], if enabled -with-openmp-flag=FLAG required])],
276            [parexa=$enableval
277             AC_MSG_RESULT(yes)],
278            [parexa="no"
279             AC_MSG_RESULT(no)])
280AM_CONDITIONAL(PAREXA,[test x${parexa} = xyes])
281
282# ADOL-C Compilation flags
283AC_MSG_CHECKING(which CFLAGS to use)
284AC_ARG_WITH(cflags,
285            [AS_HELP_STRING([--with-cflags=FLAGS],
286                            [use CFLAGS=FLAGS (default: -O2)])],
287            [ac_adolc_cflags="$withval"
288             if test x${adolc_debug} == xyes ||
289                test x${adolc_harddebug} == xyes ; then
290                ac_adolc_cflags="$ac_adolc_cflags -g -O0"
291             fi
292             ac_adolc_cflags="$ac_adolc_cflags $ac_adolc_openmpflag"
293             AC_SUBST(ac_adolc_cflags)
294             AC_MSG_RESULT($ac_adolc_cflags)],
295            [if test "$ac_shell_cflags" = "not_set"; then
296                ac_adolc_cflags="-O2"
297                if test x${adolc_debug} == xyes ||
298                   test x${adolc_harddebug} == xyes ; then
299                   ac_adolc_cflags="-g -O3 -Wall -ansi"
300                fi
301             else
302                ac_adolc_cflags="$CFLAGS"
303             fi
304             ac_adolc_cflags="$ac_adolc_cflags $ac_adolc_openmpflag"
305
306             AC_SUBST(ac_adolc_cflags)
307             AC_MSG_RESULT($ac_adolc_cflags)])
308
309AC_MSG_CHECKING(which CXXFLAGS to use)
310AC_ARG_WITH(cxxflags,
311            [AS_HELP_STRING([--with-cxxflags=FLAGS],
312                            [use CXXFLAGS=FLAGS (default: -O2)])],
313            [ac_adolc_cxxflags="$withval"
314             if test x${adolc_debug} == xyes ||
315                test x${adolc_harddebug} == xyes ; then
316                ac_adolc_cxxflags="$ac_adolc_cxxflags -g -O0"
317             fi
318             ac_adolc_cxxflags="$ac_adolc_cxxflags $ac_adolc_openmpflag"
319             AC_SUBST(ac_adolc_cxxflags)
320             AC_MSG_RESULT($ac_adolc_cxxflags)],
321            [if test "$ac_shell_cxxflags" = "not_set"; then
322                ac_adolc_cxxflags="-O2"
323                if test x${adolc_debug} == xyes ||
324                   test x${adolc_harddebug} == xyes ; then
325                   ac_adolc_cxxflags="-g -O0 -Wall"
326                fi
327             else
328                ac_adolc_cxxflags="$CXXFLAGS"
329             fi
330             ac_adolc_cxxflags="$ac_adolc_cxxflags $ac_adolc_openmpflag"
331            AC_SUBST(ac_adolc_cxxflags)
332             AC_MSG_RESULT($ac_adolc_cxxflags)])
333
334###########################################################################
335#                      COIN_PATCH_LIBTOOL_CYGWIN                          #
336###########################################################################
337
338# Patches to libtool for cygwin. Lots for cl, a few for GCC.
339# For cl:
340# - cygpath is not correctly quoted in fix_srcfile_path
341# - paths generated for .lib files is not run through cygpath -w
342
343#
344# REQUIRED FOR COMPILATION WITH CYGWIN !!!
345#
346 
347
348AC_DEFUN([AC_COIN_PATCH_LIBTOOL_CYGWIN],
349[ case "$CXX" in
350    cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*)
351      AC_MSG_NOTICE(Applying patches to libtool for cl compiler)
352      sed -e 's|fix_srcfile_path=\"`cygpath -w \"\$srcfile\"`\"|fix_srcfile_path=\"\\\`'"$CYGPATH_W"' \\\"\\$srcfile\\\"\\\`\"|' \
353          -e 's|fix_srcfile_path=\"\"|fix_srcfile_path=\"\\\`'"$CYGPATH_W"' \\\"\\$srcfile\\\"\\\`\"|' \
354          -e 's%compile_deplibs=\"\$dir/\$old_library \$compile_deplibs\"%compile_deplibs="'\`"$CYGPATH_W"' \$dir/\$old_library | sed -e '"'"'sY\\\\\\\\Y/Yg'"'"\`' \$compile_deplibs\"'% \
355          -e 's%compile_deplibs=\"\$dir/\$linklib \$compile_deplibs\"%compile_deplibs="'\`"$CYGPATH_W"' \$dir/\$linklib | sed -e '"'"'sY\\\\\\\\Y/Yg'"'"\`' \$compile_deplibs\"'% \
356          -e 's%lib /OUT:%lib -OUT:%' \
357          -e "s%cygpath -w%$CYGPATH_W%" \
358          -e 's%$AR x \\$f_ex_an_ar_oldlib%bla=\\`lib -nologo -list \\$f_ex_an_ar_oldlib | xargs echo '"$mydos2unix"'\\`; echo \\$bla; for i in \\$bla; do lib -nologo -extract:\\$i \\$f_ex_an_ar_oldlib; done%' \
359          -e 's/$AR t/lib -nologo -list/' \
360          -e 's%f_ex_an_ar_oldlib="\($?*1*\)"%f_ex_an_ar_oldlib='\`"$CYGPATH_W"' \1`%' \
361          -e 's%^archive_cmds=.*%archive_cmds="\\$CC -o \\$lib \\$libobjs \\$compiler_flags \\\\\\`echo \\\\\\"\\$deplibs\\\\\\" | \\$SED -e '"\'"'s/ -lc\\$//'"\'"'\\\\\\` -link -dll~linknames="%' \
362          -e 's%old_archive_cmds="lib -OUT:\\$oldlib\\$oldobjs\\$old_deplibs"%old_archive_cmds="if test -r \\$oldlib; then bla=\\"\\$oldlib\\"; else bla=; fi; lib -OUT:\\$oldlib \\\\\\$bla\\$oldobjs\\$old_deplibs"%' \
363      libtool > conftest.bla
364
365      mv conftest.bla libtool
366      chmod 755 libtool
367      ;;
368    *)
369      AC_MSG_NOTICE(Applying patches to libtool for GNU compiler)
370      sed -e 's|fix_srcfile_path=\"`cygpath -w \"\$srcfile\"`\"|fix_srcfile_path=\"\\\`'"$CYGPATH_W"' \\\"\\$srcfile\\\"\\\`\"|' \
371          -e 's|"lib /OUT:\\$oldlib\\$oldobjs\\$old_deplibs"|"\\$AR \\$AR_FLAGS \\$oldlib\\$oldobjs\\$old_deplibs~\\$RANLIB \\$oldlib"|' \
372          -e 's|libext="lib"|libext="a"|' \
373      libtool > conftest.bla
374
375      mv conftest.bla libtool
376      chmod 755 libtool
377      ;;
378  esac ]) # COIN_PATCH_LIBTOOL_CYGWIN
379 
380
381# output
382AC_CONFIG_FILES(Makefile
383                ADOL-C/Makefile
384                ADOL-C/src/Makefile
385                ADOL-C/src/drivers/Makefile
386                ADOL-C/src/sparse/Makefile
387                ADOL-C/src/tapedoc/Makefile
388                ADOL-C/doc/version.tex
389                ADOL-C/examples/Makefile
390                ADOL-C/examples/additional_examples/Makefile
391                ADOL-C/examples/additional_examples/clock/Makefile
392                ADOL-C/examples/additional_examples/checkpointing/Makefile
393                ADOL-C/examples/additional_examples/ext_diff_func/Makefile
394                ADOL-C/examples/additional_examples/fixpoint_exam/Makefile
395                ADOL-C/examples/additional_examples/hessmat/Makefile
396                ADOL-C/examples/additional_examples/lufact/Makefile
397                ADOL-C/examples/additional_examples/openmp_exam/Makefile
398                ADOL-C/examples/additional_examples/scal/Makefile
399                ADOL-C/examples/additional_examples/speelpenning/Makefile
400                ADOL-C/examples/additional_examples/taylor/Makefile
401                ADOL-C/examples/additional_examples/detexam/Makefile
402                ADOL-C/examples/additional_examples/helm/Makefile
403                ADOL-C/examples/additional_examples/lighthouse/Makefile
404                ADOL-C/examples/additional_examples/ode/Makefile
405                ADOL-C/examples/additional_examples/sparse/Makefile
406                ADOL-C/examples/additional_examples/tapesave/Makefile
407                ADOL-C/examples/additional_examples/pow/Makefile
408                ADOL-C/examples/additional_examples/timing/Makefile
409                ADOL-C/test/Makefile
410                MSVisualStudio/v10/sparse/config.h
411                MSVisualStudio/v10/nosparse/config.h
412                MSVisualStudio/v10/x64/sparse/config.h
413                MSVisualStudio/v10/x64/nosparse/config.h
414                adolc.spec
415)
416
417AC_OUTPUT
418
419#call libtool for cygwin
420AC_COIN_PATCH_LIBTOOL_CYGWIN
421warn=false
422# echo configuration
423echo \
424"
425-----------------------------------------------------------------------------
426Configuration:
427
428  C compiler:                       ${CC}
429  C++ compiler:                     ${CXX}
430  Linker:                           ${LD}
431  Source code location:             `pwd`
432  Install path:                     ${prefix}
433 
434  CFLAGS:                           ${ac_adolc_cflags}
435  CXXFLAGS:                         ${ac_adolc_cxxflags}
436
437  Use ADOL-C debug mode:            ${adolc_debug}
438  Use ADOL-C hard debug mode:       ${adolc_harddebug}
439  Use ADOL-C adouble zeroing mode:  ${adolc_stdczero}"
440
441if [[ "x${ac_adolc_openmpflag}" != "x" ]] ; then
442    echo \
443"  Access thread number via errno:   ${adolc_tserrno}"
444fi
445
446echo \
447"  Use ADOL-C safe extern mode:      ${adolc_safe_extern}
448
449  Build sparse drivers:             ${sparse}
450  Build with ColPack:               ${have_colpack}"
451if test x$sparse = xyes && test x$have_colpack = xno; then
452    echo -e \
453"  \033@<:@1;31mCompressed sparse structures will not be available
454  Only sparsity patterns can be computed\033@<:@0m"
455    warn=true
456fi
457echo
458
459echo \
460"  Build documented examples:        ${docexa}
461  Build additional examples:        ${addexa}
462
463  See ADOL-C/src/config.h for further configuration information.
464-----------------------------------------------------------------------------"
465
466# check for make install problems resulting from missing write permission
467pdir=${prefix}
468writable=true
469while test "x${pdir}" != "x/" ; do
470    if test -e ${pdir} && test ! -w ${pdir}; then
471        writable=false
472        break
473    elif test ! -e ${pdir} ; then
474        pdir=`dirname ${pdir}`
475    else
476        break
477    fi
478done
479if test "x${pdir}" == "x/" ; then
480    writable=false
481fi
482if ! ${writable} ; then
483    echo -e \
484"  \033@<:@1;31mPrefix ${prefix} not writable
485  please run ./configure --prefix=DIR
486  with a writable directory path otherwise administrator privilages
487  will be required to run \`make install'\033@<:@0m"
488    warn=true
489fi
490
491case ${prefix} in
492   ${HOME}|${HOME}/*)
493if $warn ; then
494    for (( i=5; i>0; i-- )); do
495        echo -ne "\rPlease read the above messages carefully, continuing in ${i} seconds"
496        sleep 1
497    done
498    echo -e "\rPlease read the above messages carefully                                 "
499fi
500echo \
501"
502*****************************************************************************
503
504  To successfully compile and run programs using the ADOL-C shared library do
505  the following things:
506     compiling:
507        * add \"-I${prefix}/include\" to your compiler call
508     linking:
509        * add \"-L${prefix}/${_lib} -ladolc\" to your linker call
510        * extend your linker call by \"-Wl,--rpath -Wl,${prefix}/${_lib}\"
511          (if you wish to skip the point \"executing\")
512     executing (do one of the following things):
513        * add ${prefix}/${_lib} to your LD_LIBRARY_PATH variable
514        * ask your system administrator for adding ${prefix}/${_lib} to
515          the global file containing library search paths (/etc/ld.so.conf)
516
517     (or use the static library by replacing
518        \"-L${prefix}/${_lib} -ladolc\" with
519        \"${prefix}/${_lib}/libadolc.a\" when linking)
520
521  See README for instructions on how to change to a nonlocal installation!
522
523*****************************************************************************
524"
525;;
526esac
Note: See TracBrowser for help on using the repository browser.