source: trunk/configure.ac @ 372

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

Merge branch '2.3.x_ISSM' into svn

This introduces the new externally differentiated functions API

From: Jean Utke <utke@…>

Please see comments in ADOL-C/include/adolc/externfcts.h for details

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

  • Property svn:keywords set to Author Date Id Revision
File size: 17.7 KB
Line 
1##############################################################################
2# configure.ac -- Process this file with autoconf to produce configure
3# Revision: $Id: configure.ac 370 2012-11-22 13:18:52Z 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])
18config_flags="$*"
19AC_REVISION($Revision: 370 $)
20AC_CONFIG_SRCDIR([ADOL-C/src/adouble.cpp])
21AC_CONFIG_AUX_DIR(autoconf)
22AC_CONFIG_HEADERS([ADOL-C/src/config.h])
23AC_PREFIX_DEFAULT(${HOME}/adolc_base)
24AM_INIT_AUTOMAKE([1.11 dist-bzip2 foreign])
25AM_SILENT_RULES([yes])
26
27if test "x$CFLAGS" == x ; then
28    ac_shell_cflags="not_set"
29else
30    ac_shell_cflags="$CFLAGS"
31fi
32if test "x$CXXFLAGS" == x ; then
33    ac_shell_cxxflags="not_set"
34else
35    ac_shell_cxxflags="$CXXFLAGS"
36fi
37libdir_set_on_cmd="no"
38for i in $config_flags ; do
39    case $i in
40    -libdir | --libdir | --libdi | --libd | -libdir=* | --libdir=* | --libdi=* | --libd=*)
41            libdir_set_on_cmd="yes"
42            break
43            ;;
44    esac
45done
46
47# checks for programs
48AC_PROG_CXX
49AC_PROG_CC
50AC_PROG_CPP
51AC_PROG_INSTALL
52AC_PROG_LN_S
53AC_PROG_MAKE_SET
54AC_LIBTOOL_WIN32_DLL
55AC_PROG_LIBTOOL
56
57AC_CHECK_SIZEOF([void *])
58if test "x$ac_cv_sizeof_void_p" = "x8" ; then
59   _lib=lib64
60else
61   _lib=lib
62fi
63if test "x$libdir_set_on_cmd" = "xno" ; then
64   libdir='${exec_prefix}/${_lib}'
65   AC_SUBST(_lib)
66   AC_SUBST(libdir)
67fi
68
69# checks for header files
70AC_HEADER_STDC
71AC_HEADER_TIME
72AC_HEADER_STDBOOL
73AC_CHECK_HEADERS([stddef.h stdlib.h stdio.h string.h unistd.h sys/timeb.h])
74
75# checks for types
76AC_C_CONST
77AC_C_INLINE
78AC_TYPE_SIZE_T
79AC_STRUCT_TM
80
81# Checks for library functions
82AC_FUNC_MALLOC
83AC_FUNC_REALLOC
84
85# Checks for libraries and fuctions
86AC_SEARCH_LIBS([pow], [m])
87AC_CHECK_FUNCS([floor fmax fmin ftime pow sqrt strchr strtol trunc])
88
89# substitutions
90AC_SUBST(ac_aux_dir)
91
92# ADOL-C configuration
93AC_DEFINE(ADOLC_VERSION,ADOLC_VER,[ADOL-C Version])
94AC_DEFINE(ADOLC_SUBVERSION,ADOLC_SUB,[ADOL-C Subversion])
95AC_DEFINE(ADOLC_PATCHLEVEL,ADOLC_LVL,[ADOL-C Patchlevel])
96ADOLC_VERSION=ADOLC_VER
97ADOLC_SUBVERSION=ADOLC_SUB
98ADOLC_PATCHLEVEL=ADOLC_LVL
99AC_SUBST(ADOLC_VERSION)
100AC_SUBST(ADOLC_SUBVERSION)
101AC_SUBST(ADOLC_PATCHLEVEL)
102
103AC_MSG_CHECKING(whether to use ADOL-C debug mode)
104AC_ARG_ENABLE(debug,
105              [
106AS_HELP_STRING([--enable-debug],[enable ADOL-C debug mode [default=no]])],
107  [
108  adolc_debug=$enableval
109   AC_MSG_RESULT($adolc_debug)
110   ],
111  [
112   adolc_debug=no
113   AC_MSG_RESULT(no)
114   ])
115
116AC_MSG_CHECKING(whether to use ADOL-C hard debug mode)
117AC_ARG_ENABLE(harddebug,
118              [
119AS_HELP_STRING([--enable-harddebug],[enable ADOL-C hard debug mode
120 [default=no]])],
121  [
122   adolc_harddebug=$enableval
123   AC_MSG_RESULT($adolc_harddebug)
124   ],
125  [
126   adolc_harddebug=no
127   AC_MSG_RESULT(no)
128   ])
129
130if test x$adolc_harddebug == xyes ; then
131adolc_debug=yes
132AC_DEFINE(ADOLC_HARDDEBUG,1,[ADOL-C hard debug mode])
133fi
134
135if test x$adolc_debug == xyes ; then
136AC_DEFINE(ADOLC_DEBUG,1,[ADOL-C debug mode])
137fi
138
139AC_MSG_CHECKING(whether the default adouble constructor should initialize the value to 0)
140AC_ARG_ENABLE(stdczero,
141              [
142AS_HELP_STRING([--disable-stdczero],[adouble default constructor does not initialze the value to zero
143(improves performance but yields incorrect results for implicit array initializations, see manual) [default=enabled]])],
144  [
145  adolc_stdczero=no
146  AC_MSG_RESULT(no)
147  ],
148  [
149  adolc_stdczero=yes
150  AC_MSG_RESULT(yes)
151  ])
152
153if test x$adolc_stdczero == xyes; then
154AC_DEFINE(ADOLC_ADOUBLE_STDCZERO,1,[ADOL-C adouble zeroing mode])
155fi
156
157AC_MSG_CHECKING(whether errno is thread save)
158AC_ARG_ENABLE(tserrno,
159              [
160AS_HELP_STRING([--enable-tserrno],[use errno as thread number cache [default=no]])],
161  [
162  adolc_tserrno=$enableval
163  AC_MSG_RESULT($adolc_tserrno)
164   ],
165  [
166  adolc_tserrno=no
167  AC_MSG_RESULT(no)
168  ])
169
170if test x$adolc_tserrno == xyes ; then
171AC_DEFINE(ADOLC_THREADSAVE_ERRNO,1,[ADOL-C thread save errno mode])
172fi
173
174AC_MSG_CHECKING(which flag to use to enable OpenMP)
175AC_ARG_WITH(openmp-flag,
176            [AS_HELP_STRING([--with-openmp-flag=FLAG],
177                            [use FLAG to enable OpenMP at compile time [default=none]])],
178            [ac_adolc_openmpflag=$withval
179             AC_MSG_RESULT($ac_adolc_openmpflag)],
180            [ac_adolc_openmpflag=""
181             AC_MSG_RESULT(none)])
182
183
184# ADOL-C Sparse facility
185AC_MSG_CHECKING(whether to build sparse drivers)
186AC_ARG_ENABLE(sparse,
187            [
188AS_HELP_STRING([--enable-sparse],[build sparse drivers [default=disabled]])],
189            [sparse=$enableval
190             AC_MSG_RESULT($sparse)],
191            [sparse="no"
192             AC_MSG_RESULT(no)])
193
194AC_ARG_WITH(colpack,
195        [
196AS_HELP_STRING([--with-colpack=DIR],[path to the colpack library and headers [default=system libraries]])],
197[
198colpack=$withval
199COLPACK_CFLAGS="$ac_adolc_openmpflag -I$colpack/include"
200COLPACK_LIBDIR="$colpack/${_lib}"
201COLPACK_LIBS="$ac_adolc_openmpflag -L$COLPACK_LIBDIR -lColPack"
202],
203[
204COLPACK_CFLAGS="$ac_adolc_openmpflag"
205COLPACK_LIBDIR=""
206COLPACK_LIBS="-lColPack"
207])
208
209AC_LANG_PUSH([C++])
210save_CPPFLAGS="$CPPFLAGS"
211save_LIBS="$LIBS"
212CPPFLAGS="$CPPFLAGS $COLPACK_CFLAGS"
213LIBS="$COLPACK_LIBS $LIBS"
214AC_MSG_CHECKING(for ColPack in $COLPACK_LIBDIR)
215AC_CHECK_HEADER([ColPack/ColPackHeaders.h],[have_colpackheaders=yes],[have_colpackheaders=no])
216if test x$have_colpackheaders = xyes ; then
217   AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <ColPack/ColPackHeaders.h>],
218                        [ColPack::GraphColoring g])],
219                       [have_colpack=yes
220                        AC_MSG_RESULT(linking with -lColPack succeeded)],
221                       [have_colpack=no,
222                        AC_MSG_RESULT(linking with -lColPack failed)])
223else
224    have_colpack=no
225fi
226CPPFLAGS="$save_CPPFLAGS"
227LIBS="$save_LIBS"
228AC_LANG_POP([C++])
229
230AM_CONDITIONAL(HAVE_LIBCOLPACK,[test x$have_colpack = xyes])
231if test x$have_colpack = xyes; then
232   sparse=yes
233   echo "will build sparse drivers as linking with -lColPack succeeded"
234fi
235AM_CONDITIONAL(SPARSE,[test x${sparse} = xyes])
236
237if test x$sparse = xyes && test x$have_colpack = xyes; then
238        AC_DEFINE(HAVE_LIBCOLPACK,[1],[Define 1 if ColPack is available])
239else
240        COLPACK_CFLAGS=""
241        COLPACK_LIBS=""
242fi
243AC_SUBST(COLPACK_CFLAGS)
244AC_SUBST(COLPACK_LIBS)
245
246# ADOL-C Examples
247AC_MSG_CHECKING(whether to build documented examples)
248AC_ARG_ENABLE(docexa,
249            [
250AS_HELP_STRING([--enable-docexa],[build documented examples [default=disabled]])],
251            [docexa=$enableval
252             AC_MSG_RESULT(yes)],
253            [docexa="no"
254             AC_MSG_RESULT(no)])
255AM_CONDITIONAL(DOCEXA,[test x${docexa} = xyes])
256
257AC_MSG_CHECKING(whether to build additional examples)
258AC_ARG_ENABLE(addexa,
259            [AS_HELP_STRING([--enable-addexa],
260                            [build additional examples [default=disabled]])],
261            [addexa=$enableval
262             AC_MSG_RESULT(yes)],
263            [addexa="no"
264             AC_MSG_RESULT(no)])
265AM_CONDITIONAL(ADDEXA,[test x${addexa} = xyes])
266
267AC_MSG_CHECKING(whether to build parallel example)
268AC_ARG_ENABLE(parexa,
269            [AS_HELP_STRING([--enable-parexa],
270                            [build parallel example [default=disabled], if enabled -with-openmp-flag=FLAG required])],
271            [parexa=$enableval
272             AC_MSG_RESULT(yes)],
273            [parexa="no"
274             AC_MSG_RESULT(no)])
275AM_CONDITIONAL(PAREXA,[test x${parexa} = xyes])
276
277# ADOL-C Compilation flags
278AC_MSG_CHECKING(which CFLAGS to use)
279AC_ARG_WITH(cflags,
280            [AS_HELP_STRING([--with-cflags=FLAGS],
281                            [use CFLAGS=FLAGS (default: -O2)])],
282            [ac_adolc_cflags="$withval"
283             if test x${adolc_debug} == xyes ||
284                test x${adolc_harddebug} == xyes ; then
285                ac_adolc_cflags="$ac_adolc_cflags -g -O0"
286             fi
287             ac_adolc_cflags="$ac_adolc_cflags $ac_adolc_openmpflag"
288             AC_SUBST(ac_adolc_cflags)
289             AC_MSG_RESULT($ac_adolc_cflags)],
290            [if test "$ac_shell_cflags" = "not_set"; then
291                ac_adolc_cflags="-O2"
292                if test x${adolc_debug} == xyes ||
293                   test x${adolc_harddebug} == xyes ; then
294                   ac_adolc_cflags="-g -O3 -Wall -ansi"
295                fi
296             else
297                ac_adolc_cflags="$CFLAGS"
298             fi
299             ac_adolc_cflags="$ac_adolc_cflags $ac_adolc_openmpflag"
300
301             AC_SUBST(ac_adolc_cflags)
302             AC_MSG_RESULT($ac_adolc_cflags)])
303
304AC_MSG_CHECKING(which CXXFLAGS to use)
305AC_ARG_WITH(cxxflags,
306            [AS_HELP_STRING([--with-cxxflags=FLAGS],
307                            [use CXXFLAGS=FLAGS (default: -O2)])],
308            [ac_adolc_cxxflags="$withval"
309             if test x${adolc_debug} == xyes ||
310                test x${adolc_harddebug} == xyes ; then
311                ac_adolc_cxxflags="$ac_adolc_cxxflags -g -O0"
312             fi
313             ac_adolc_cxxflags="$ac_adolc_cxxflags $ac_adolc_openmpflag"
314             AC_SUBST(ac_adolc_cxxflags)
315             AC_MSG_RESULT($ac_adolc_cxxflags)],
316            [if test "$ac_shell_cxxflags" = "not_set"; then
317                ac_adolc_cxxflags="-O2"
318                if test x${adolc_debug} == xyes ||
319                   test x${adolc_harddebug} == xyes ; then
320                   ac_adolc_cxxflags="-g -O0 -Wall"
321                fi
322             else
323                ac_adolc_cxxflags="$CXXFLAGS"
324             fi
325             ac_adolc_cxxflags="$ac_adolc_cxxflags $ac_adolc_openmpflag"
326            AC_SUBST(ac_adolc_cxxflags)
327             AC_MSG_RESULT($ac_adolc_cxxflags)])
328
329###########################################################################
330#                      COIN_PATCH_LIBTOOL_CYGWIN                          #
331###########################################################################
332
333# Patches to libtool for cygwin. Lots for cl, a few for GCC.
334# For cl:
335# - cygpath is not correctly quoted in fix_srcfile_path
336# - paths generated for .lib files is not run through cygpath -w
337
338#
339# REQUIRED FOR COMPILATION WITH CYGWIN !!!
340#
341 
342
343AC_DEFUN([AC_COIN_PATCH_LIBTOOL_CYGWIN],
344[ case "$CXX" in
345    cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*)
346      AC_MSG_NOTICE(Applying patches to libtool for cl compiler)
347      sed -e 's|fix_srcfile_path=\"`cygpath -w \"\$srcfile\"`\"|fix_srcfile_path=\"\\\`'"$CYGPATH_W"' \\\"\\$srcfile\\\"\\\`\"|' \
348          -e 's|fix_srcfile_path=\"\"|fix_srcfile_path=\"\\\`'"$CYGPATH_W"' \\\"\\$srcfile\\\"\\\`\"|' \
349          -e 's%compile_deplibs=\"\$dir/\$old_library \$compile_deplibs\"%compile_deplibs="'\`"$CYGPATH_W"' \$dir/\$old_library | sed -e '"'"'sY\\\\\\\\Y/Yg'"'"\`' \$compile_deplibs\"'% \
350          -e 's%compile_deplibs=\"\$dir/\$linklib \$compile_deplibs\"%compile_deplibs="'\`"$CYGPATH_W"' \$dir/\$linklib | sed -e '"'"'sY\\\\\\\\Y/Yg'"'"\`' \$compile_deplibs\"'% \
351          -e 's%lib /OUT:%lib -OUT:%' \
352          -e "s%cygpath -w%$CYGPATH_W%" \
353          -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%' \
354          -e 's/$AR t/lib -nologo -list/' \
355          -e 's%f_ex_an_ar_oldlib="\($?*1*\)"%f_ex_an_ar_oldlib='\`"$CYGPATH_W"' \1`%' \
356          -e 's%^archive_cmds=.*%archive_cmds="\\$CC -o \\$lib \\$libobjs \\$compiler_flags \\\\\\`echo \\\\\\"\\$deplibs\\\\\\" | \\$SED -e '"\'"'s/ -lc\\$//'"\'"'\\\\\\` -link -dll~linknames="%' \
357          -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"%' \
358      libtool > conftest.bla
359
360      mv conftest.bla libtool
361      chmod 755 libtool
362      ;;
363    *)
364      AC_MSG_NOTICE(Applying patches to libtool for GNU compiler)
365      sed -e 's|fix_srcfile_path=\"`cygpath -w \"\$srcfile\"`\"|fix_srcfile_path=\"\\\`'"$CYGPATH_W"' \\\"\\$srcfile\\\"\\\`\"|' \
366          -e 's|"lib /OUT:\\$oldlib\\$oldobjs\\$old_deplibs"|"\\$AR \\$AR_FLAGS \\$oldlib\\$oldobjs\\$old_deplibs~\\$RANLIB \\$oldlib"|' \
367          -e 's|libext="lib"|libext="a"|' \
368      libtool > conftest.bla
369
370      mv conftest.bla libtool
371      chmod 755 libtool
372      ;;
373  esac ]) # COIN_PATCH_LIBTOOL_CYGWIN
374 
375
376# output
377AC_CONFIG_FILES(Makefile
378                ADOL-C/Makefile
379                ADOL-C/include/Makefile
380                ADOL-C/include/adolc/Makefile
381                ADOL-C/include/adolc/drivers/Makefile
382                ADOL-C/include/adolc/sparse/Makefile
383                ADOL-C/include/adolc/tapedoc/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  Zero value in adouble default ctor: ${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.