1##############################################################################
2# configure.ac -- Process this file with autoconf to produce configure
3# Revision: $Id: configure.ac 794 2020-02-01 20:29:18Z 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], [7])
12define([ADOLC_LVL], [2])
13
14AC_PREREQ(2.67)
15AC_INIT(adolc,
16        ADOLC_VER.ADOLC_SUB.ADOLC_LVL,
17        [adol-c@list.coin-or.org])
18config_flags="$*"
19AC_REVISION($Revision: 794 $)
20AC_CONFIG_SRCDIR([ADOL-C/src/adouble.cpp])
21AC_CONFIG_AUX_DIR([autoconf])
22AC_CONFIG_MACRO_DIR([autoconf])
23AC_CONFIG_HEADERS([ADOL-C/src/config.h])
24AC_PREFIX_DEFAULT(${HOME}/adolc_base)
25AM_INIT_AUTOMAKE([1.11 dist-bzip2 foreign subdir-objects])
26AM_SILENT_RULES([yes])
27AM_MAINTAINER_MODE([disable])
28
29
30adolclib=adolc
31
32if test "x$CFLAGS" == x ; then
33    ac_shell_cflags="not_set"
34else
35    ac_shell_cflags="$CFLAGS"
36fi
37if test "x$CXXFLAGS" == x ; then
38    ac_shell_cxxflags="not_set"
39else
40    ac_shell_cxxflags="$CXXFLAGS"
41fi
42libdir_set_on_cmd="no"
43for i in $config_flags ; do
44    case $i in
45    -libdir | --libdir | --libdi | --libd | -libdir=* | --libdir=* | --libdi=* | --libd=*)
46            libdir_set_on_cmd="yes"
47            break
48            ;;
49    esac
50done
51
52AM_CONDITIONAL(DARWIN, [test "x${host_os#darwin}" != "x${host_os}"])
53
54AC_MSG_CHECKING(whether to build ADOL-C with adjoinable MPI (AMPI) support)
55AC_ARG_ENABLE(ampi,
56              [AS_HELP_STRING([--enable-ampi],[build ADOL-C with adjoinable MPI (AMPI) support [default=disabled]])],
57	      [adolc_ampi_support=$enableval],[adolc_ampi_support=no])
58AC_MSG_RESULT($adolc_ampi_support)
59AM_CONDITIONAL(BUILD_ADOLC_AMPI_SUPPORT,[test x${adolc_ampi_support} = xyes])
60if test x"${adolc_ampi_support}" = xyes ; then
61AC_DEFINE(ADOLC_AMPI_SUPPORT,1,[defined if adjoinable MPI support is to be compiled in])
62fi
63
64AC_MSG_CHECKING(whether to build ADOL-C with MeDiPack (MPI) support)
65AC_ARG_ENABLE(medipack,
66              [AS_HELP_STRING([--enable-medipack],[build ADOL-C with MeDiPack (MPI) support [default=disabled]])],
67	      [adolc_medipack_support=$enableval],[adolc_medipack_support=no])
68AC_MSG_RESULT($adolc_medipack_support)
69AM_CONDITIONAL(BUILD_ADOLC_MEDIPACK_SUPPORT,[test x${adolc_medipack_support} = xyes])
70if test x"${adolc_medipack_support}" = xyes ; then
71AC_DEFINE(ADOLC_MEDIPACK_SUPPORT,1,[defined if MeDiPack support is to be compiled in])
72fi
73
74LT_PREREQ([2.2.6])
75# checks for programs
76AC_PROG_CXX
77AX_CXX_COMPILE_STDCXX_11(noext,mandatory)
78AC_PROG_CC
79AC_PROG_CC_C_O
80AC_PROG_CC_C99
81AC_PROG_CPP
82AC_PROG_INSTALL
83AC_PROG_LN_S
84AC_PROG_MAKE_SET
85LT_INIT([disable-static win32-dll dlopen])
86
87if test "x$enable_static" != "xno" ; then
88   AC_MSG_WARN([Linking a user program with static ADOL-C library will always result in a segmentation fault])
89fi
90
91MPI_CONF_PRE
92
93AC_CHECK_SIZEOF([void *])
94if test "x$ac_cv_sizeof_void_p" = "x8" ; then
95   _lib=lib64
96else
97   _lib=lib
98fi
99if test "x$libdir_set_on_cmd" = "xno" ; then
100   libdir='${exec_prefix}'/"${_lib}"
101   AC_SUBST(_lib)
102   AC_SUBST(libdir)
103fi
104
105# check for builtin
106ACX_C_BUILTIN_EXPECT
107
108# checks for header files
109AC_HEADER_STDC
110AC_HEADER_TIME
111AC_HEADER_STDBOOL
112AC_CHECK_HEADERS([stddef.h stdlib.h stdio.h string.h unistd.h sys/timeb.h])
113
114# checks for types
115AC_C_CONST
116AC_C_INLINE
117AC_TYPE_SIZE_T
118AC_STRUCT_TM
119
120
121# Checks for libraries and fuctions
122AC_SEARCH_LIBS([pow], [m])
123AC_CHECK_FUNCS([floor fmax fmin ftime pow sqrt cbrt strchr strtol trunc])
124
125# substitutions
126AC_SUBST(ac_aux_dir)
127
128# ADOL-C configuration
129AC_DEFINE(ADOLC_VERSION,ADOLC_VER,[ADOL-C Version])
130AC_DEFINE(ADOLC_SUBVERSION,ADOLC_SUB,[ADOL-C Subversion])
131AC_DEFINE(ADOLC_PATCHLEVEL,ADOLC_LVL,[ADOL-C Patchlevel])
132ADOLC_VERSION=ADOLC_VER
133ADOLC_SUBVERSION=ADOLC_SUB
134ADOLC_PATCHLEVEL=ADOLC_LVL
135AC_SUBST(ADOLC_VERSION)
136AC_SUBST(ADOLC_SUBVERSION)
137AC_SUBST(ADOLC_PATCHLEVEL)
138
139# Checks for library functions
140AC_FUNC_MALLOC
141AC_FUNC_REALLOC
142if test x$ac_cv_func_malloc_0_nonnull != xyes ; then
143AC_DEFINE_UNQUOTED([calloc],[rpl_calloc],[Define to rpl_calloc if the replacement function should be used.])
144fi
145
146AC_MSG_CHECKING(whether to use calloc or malloc for memory allocation)
147AC_ARG_ENABLE(use-calloc,[AS_HELP_STRING([--disable-use-calloc],
148  [disable use of calloc and use malloc instead for memory allocation [default=calloc is used]])],
149  [use_calloc=$enableval],[use_calloc=yes])
150
151if test x$use_calloc = xyes ; then
152AC_MSG_RESULT(calloc)
153AC_DEFINE(ADOLC_USE_CALLOC,1,[Use calloc instead of malloc for memory allocation])
154else
155AC_MSG_RESULT(malloc)
156fi
157
158AC_MSG_CHECKING(whether to enable atrig/erf functions)
159AC_ARG_ENABLE(atrig-erf,[AS_HELP_STRING([--enable-atrig-erf],
160  [enable atrig and erf functions in ADOL-C [default=no]])],
161  [use_atrig_erf=$enableval],[use_atrig_erf=no])
162AC_MSG_RESULT($use_atrig_erf)
163
164if test x$use_atrig_erf = xyes ; then
165  ATRIG_ERF="#define ATRIG_ERF 1"
166else
167  ATRIG_ERF="#undef ATRIG_ERF"
168fi
169AC_SUBST(ATRIG_ERF)
170
171AC_MSG_CHECKING(whether to use 32-bit or 64-bit locations)
172AC_ARG_ENABLE(ulong,[AS_HELP_STRING([--enable-ulong],
173  [enable 64-bit locations (only available on 64-bit systems) [default=32-bit]])],
174  [use_ulong=$enableval],[use_ulong=no])
175
176if test x$use_ulong = xyes -a 0$ac_cv_sizeof_void_p -ge 8 ; then
177  UINT_TYPE=uint64_t
178  AC_MSG_RESULT(64-bit)
179else
180  UINT_TYPE=uint32_t
181  AC_MSG_RESULT(32-bit)
182fi
183AC_SUBST(UINT_TYPE)
184
185AC_MSG_CHECKING(whether to use single or double precision)
186AC_ARG_ENABLE(double,[AS_HELP_STRING([--disable-double],
187  [disable double precision arithmetic [untested, default=double is enabled]])],
188  [use_double=$enableval],[use_double=yes])
189
190if test x$use_double = xno ; then
191  REAL_TYPE=float
192  echo
193  echo -n "using ${REAL_TYPE} is not well tested, please report bugs if you find any..."
194else
195  REAL_TYPE=double
196fi
197AC_MSG_RESULT($REAL_TYPE)
198AC_SUBST(REAL_TYPE)
199
200AC_MSG_CHECKING(whether to enable advanced branching operations)
201AC_ARG_ENABLE(advanced-branching, [AS_HELP_STRING([--enable-advanced-branching],
202  [enable advanced branching operations to reduce retaping [default=no].
203The boolean valued comparison operators with two adouble arguments will
204not return boolean results but the active results may be used to automatically
205switch branches in conjunction with condassign or advector (see manual).])],
206  [use_advbranch=$enableval],[use_advbranch=no])
207AC_MSG_RESULT($use_advbranch)
208
209if test x$use_advbranch = xyes ; then
210  ADVBRANCH="#define ADOLC_ADVANCED_BRANCHING 1"
211else
212  ADVBRANCH="#undef ADOLC_ADVANCED_BRANCHING"
213fi
214AC_SUBST(ADVBRANCH)
215
216AC_MSG_CHECKING(whether to enable reference counting for tapeless numbers)
217AC_ARG_ENABLE(traceless-refcounting, [AS_HELP_STRING([--enable-traceless-refcounting],
218  [enable reference counting for tapeless numbers [default=no].
219With this enabled some additional checks will be conducted when setting the
220number of directional derivatives for tapeless numbers using the SetNumDir()
221function. ])],
222  [use_adtl_refcnt=$enableval],[use_adtl_refcnt=no])
223AC_MSG_RESULT($use_adtl_refcnt)
224
225if test x$use_adtl_refcnt = xyes ; then
226  ADTL_REFCNT="#define USE_ADTL_REFCOUNTING 1"
227else
228  ADTL_REFCNT="#undef USE_ADTL_REFCOUNTING"
229fi
230AC_SUBST(ADTL_REFCNT)
231
232AC_MSG_CHECKING(whether to enable activity tracking)
233AC_ARG_ENABLE(activity-tracking, [AS_HELP_STRING([--enable-activity-tracking],
234  [enable activity tracking to reduce trace size but increased tracing time [default=no].
235Only the operations involving actual dependency relationships from the
236independent variables will be recorded on the trace, this however
237requires more checks to be performed during the tracing and increases
238tracing time. Useful only if memory is a constraint and tracing is
239done fewer times than derivative computations.])],
240  [use_activities=$enableval],[use_activities=no])
241AC_MSG_RESULT($use_activities)
242
243if test x$use_activities = xyes ; then
244AC_DEFINE(ADOLC_TRACK_ACTIVITY,1,[ADOL-C activity tracking in live variables])
245fi
246
247AC_MSG_CHECKING(whether to use ADOL-C debug mode)
248AC_ARG_ENABLE(debug,
249              [
250AS_HELP_STRING([--enable-debug],[enable ADOL-C debug mode [default=no]])],
251  [
252  adolc_debug=$enableval
253   AC_MSG_RESULT($adolc_debug)
254   ],
255  [
256   adolc_debug=no
257   AC_MSG_RESULT(no)
258   ])
259
260AC_MSG_CHECKING(whether to use ADOL-C hard debug mode)
261AC_ARG_ENABLE(harddebug,
262              [
263AS_HELP_STRING([--enable-harddebug],[enable ADOL-C hard debug mode
264 [default=no]])],
265  [
266   adolc_harddebug=$enableval
267   AC_MSG_RESULT($adolc_harddebug)
268   ],
269  [
270   adolc_harddebug=no
271   AC_MSG_RESULT(no)
272   ])
273
274if test x$adolc_harddebug == xyes ; then
275adolc_debug=yes
276AC_DEFINE(ADOLC_HARDDEBUG,1,[ADOL-C hard debug mode])
277fi
278
279if test x$adolc_debug == xyes ; then
280AC_DEFINE(ADOLC_DEBUG,1,[ADOL-C debug mode])
281fi
282
283AC_MSG_CHECKING(whether the default adouble constructor should initialize the value to 0)
284AC_ARG_ENABLE(stdczero,
285              [
286AS_HELP_STRING([--disable-stdczero],[adouble default constructor does not initialize the value to zero
287(improves performance but yields incorrect results for implicit array initializations, see manual) [default=enabled]])],
288  [
289  adolc_stdczero=no
290  AC_MSG_RESULT(no)
291  ],
292  [
293  adolc_stdczero=yes
294  AC_MSG_RESULT(yes)
295  ])
296
297if test x$adolc_stdczero == xyes; then
298AC_DEFINE(ADOLC_ADOUBLE_STDCZERO,1,[ADOL-C adouble zeroing mode])
299fi
300
301AC_MSG_CHECKING(whether the adouble variables have a late initialize option for functions like malloc/realloc)
302AC_ARG_ENABLE(lateinit,
303              [
304AS_HELP_STRING([--enable-lateinit],[adouble constructors need to be called. With malloc or realloc that is not the case. With this option the adouble can do a late initialization.) [default=disabled]])],
305  [
306  adolc_late_init=yes
307  AC_MSG_RESULT(yes)
308  ],
309  [
310  adolc_late_init=no
311  AC_MSG_RESULT(no)
312  ])
313
314if test x$adolc_late_init == xyes; then
315AC_DEFINE(ADOLC_ADOUBLE_LATEINIT,1,[ADOL-C adouble late initialization mode])
316fi
317
318AC_MSG_CHECKING(whether errno is thread save)
319AC_ARG_ENABLE(tserrno,
320              [
321AS_HELP_STRING([--enable-tserrno],[use errno as thread number cache [default=no]])],
322  [
323  adolc_tserrno=$enableval
324  AC_MSG_RESULT($adolc_tserrno)
325   ],
326  [
327  adolc_tserrno=no
328  AC_MSG_RESULT(no)
329  ])
330
331if test x$adolc_tserrno == xyes ; then
332AC_DEFINE(ADOLC_THREADSAVE_ERRNO,1,[ADOL-C thread save errno mode])
333fi
334
335AC_MSG_CHECKING(which flag to use to enable OpenMP)
336AC_ARG_WITH(openmp-flag,
337            [AS_HELP_STRING([--with-openmp-flag=FLAG],
338                            [use FLAG to enable OpenMP at compile time [default=none]])],
339            [ac_adolc_openmpflag=$withval
340             AC_MSG_RESULT($ac_adolc_openmpflag)],
341            [ac_adolc_openmpflag=""
342             AC_MSG_RESULT(none)])
343
344AX_BOOST_BASE([1.54],[boost_new=yes],[boost_new=no])
345if test x$boost_new = xyes ; then
346CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
347AC_LANG_PUSH([C++])
348AC_CHECK_HEADERS([boost/pool/pool_alloc.hpp])
349AC_LANG_POP([C++])
350AX_BOOST_SYSTEM
351LDFLAGS="$LDFLAGS $BOOST_LDFLAGS $BOOST_SYSTEM_LIB"
352fi
353
354if test "x$want_boost" = xyes -a "x$boost_new" = xyes -a "x$ac_cv_header_boost_pool_pool_alloc_hpp" = xyes -a "x$link_system" = xyes ; then
355    using_boost_pool=yes
356    USE_BOOST_POOL="#define USE_BOOST_POOL 1"
357else
358    using_boost_pool=no
359    USE_BOOST_POOL="#define USE_BOOST_POOL 0"
360fi
361AC_SUBST(USE_BOOST_POOL)
362
363if test "x$using_boost_pool" = xyes -a "x$ac_adolc_openmpflag" = x ; then
364   AC_DEFINE(BOOST_POOL_NO_MT,1,[Boost pool should not assume multithreading])
365fi
366
367# ADOL-C Sparse facility
368AC_MSG_CHECKING(whether to build sparse drivers)
369AC_ARG_ENABLE(sparse,
370            [
371AS_HELP_STRING([--enable-sparse],[build sparse drivers [default=disabled]])],
372            [sparse=$enableval
373             AC_MSG_RESULT($sparse)],
374            [sparse="no"
375             AC_MSG_RESULT(no)])
376
377COLPACK_CONF
378
379AM_CONDITIONAL(SPARSE,[test x${sparse} = xyes])
380
381SPARSE_DRIVERS="#undef SPARSE_DRIVERS"
382
383if test x$sparse = xyes ; then
384   AC_DEFINE(SPARSE,[1],[Define 1 if sparse derivative propagation is to be enabled])
385   SPARSE_DRIVERS="#define SPARSE_DRIVERS 1"
386fi
387
388AC_SUBST(SPARSE_DRIVERS)
389
390# ADOL-C Examples
391AC_MSG_CHECKING(whether to build documented examples)
392AC_ARG_ENABLE(docexa,
393            [
394AS_HELP_STRING([--enable-docexa],[build documented examples [default=disabled]])],
395            [docexa=$enableval
396             AC_MSG_RESULT(yes)],
397            [docexa="no"
398             AC_MSG_RESULT(no)])
399AM_CONDITIONAL(DOCEXA,[test x${docexa} = xyes])
400
401AC_MSG_CHECKING(whether to build additional examples)
402AC_ARG_ENABLE(addexa,
403            [AS_HELP_STRING([--enable-addexa],
404                            [build additional examples [default=disabled]])],
405            [addexa=$enableval
406             AC_MSG_RESULT(yes)],
407            [addexa="no"
408             AC_MSG_RESULT(no)])
409AM_CONDITIONAL(ADDEXA,[test x${addexa} = xyes])
410
411AC_MSG_CHECKING(whether to build parallel example)
412AC_ARG_ENABLE(parexa,
413            [AS_HELP_STRING([--enable-parexa],
414                            [build parallel example [default=disabled], if enabled -with-openmp-flag=FLAG required])],
415            [parexa=$enableval
416             AC_MSG_RESULT(yes)],
417            [parexa="no"
418             AC_MSG_RESULT(no)])
419AM_CONDITIONAL(PAREXA,[test x${parexa} = xyes])
420
421# ADOL-C Compilation flags
422AC_MSG_CHECKING(which CFLAGS to use)
423AC_ARG_WITH(cflags,
424            [AS_HELP_STRING([--with-cflags=FLAGS],
425                            [use CFLAGS=FLAGS (default: -O2)])],
426            [ac_adolc_cflags="$withval"
427             if test x${adolc_debug} == xyes ||
428                test x${adolc_harddebug} == xyes ; then
429                ac_adolc_cflags="$ac_adolc_cflags -g -O0"
430             fi
431             ac_adolc_cflags="$ac_adolc_cflags $ac_adolc_openmpflag"
432             AC_SUBST(ac_adolc_cflags)
433             AC_MSG_RESULT($ac_adolc_cflags)],
434            [if test "$ac_shell_cflags" = "not_set"; then
435                ac_adolc_cflags="-O2"
436                if test x${adolc_debug} == xyes ||
437                   test x${adolc_harddebug} == xyes ; then
438                   ac_adolc_cflags="-g -O0 -Wall -ansi"
439                fi
440             else
441                ac_adolc_cflags="$CFLAGS"
442             fi
443             ac_adolc_cflags="$ac_adolc_cflags $ac_adolc_openmpflag"
444
445             AC_SUBST(ac_adolc_cflags)
446             AC_MSG_RESULT($ac_adolc_cflags)])
447
448AC_MSG_CHECKING(which CXXFLAGS to use)
449AC_ARG_WITH(cxxflags,
450            [AS_HELP_STRING([--with-cxxflags=FLAGS],
451                            [use CXXFLAGS=FLAGS (default: -O2)])],
452            [ac_adolc_cxxflags="$withval"
453             if test x${adolc_debug} == xyes ||
454                test x${adolc_harddebug} == xyes ; then
455                ac_adolc_cxxflags="$ac_adolc_cxxflags -g -O0"
456             fi
457             ac_adolc_cxxflags="$ac_adolc_cxxflags $ac_adolc_openmpflag"
458             AC_SUBST(ac_adolc_cxxflags)
459             AC_MSG_RESULT($ac_adolc_cxxflags)],
460            [if test "$ac_shell_cxxflags" = "not_set"; then
461                ac_adolc_cxxflags="-O2"
462                if test x${adolc_debug} == xyes ||
463                   test x${adolc_harddebug} == xyes ; then
464                   ac_adolc_cxxflags="-g -O0 -Wall"
465                fi
466             else
467                ac_adolc_cxxflags="$CXXFLAGS"
468             fi
469             ac_adolc_cxxflags="$ac_adolc_cxxflags $ac_adolc_openmpflag"
470            AC_SUBST(ac_adolc_cxxflags)
471            AC_MSG_RESULT($ac_adolc_cxxflags)])
472
473MPI_CONF_POST
474AMPI_CONF
475MEDIPACK_CONF
476
477AC_ARG_WITH(soname,
478            [AS_HELP_STRING([--with-soname=NAME],
479              [user can choose what to call his library here [default: if ampi enabled then adolc_ampi otherwise adolc]])],
480      [adolclib=$withval])
481
482AC_SUBST(adolclib)
483
484AC_MSG_CHECKING(whether tape_doc should compute values as it prints the tape contents)
485AC_ARG_ENABLE(tapedoc_values,
486              [
487		AS_HELP_STRING([--disable-tapedoc-values],
488			       [should the tape_doc routine compute the values as it interprets and prints the tape contents [default=enabled]])],
489  [
490  tapedoc_values=no
491  ],
492  [
493  tapedoc_values=yes
494  ])
495AC_MSG_RESULT($tapedoc_values)
496
497if test x$tapedoc_values == xyes; then
498AC_DEFINE(ADOLC_TAPE_DOC_VALUES,1,[ADOL-C tape_doc routine computes values])
499fi
500
501AM_PATH_PYTHON([2.7],[python_found=yes],[python_found=no])
502AC_PATH_PROG(SWIG, swig, [no])
503AM_CONDITIONAL(PYTHONFOUND, [test x$python_found = xyes && test x$SWIG != xno])
504###########################################################################
505#                      COIN_PATCH_LIBTOOL_CYGWIN                          #
506###########################################################################
507
508# Patches to libtool for cygwin. Lots for cl, a few for GCC.
509# For cl:
510# - cygpath is not correctly quoted in fix_srcfile_path
511# - paths generated for .lib files is not run through cygpath -w
512
513#
514# REQUIRED FOR COMPILATION WITH CYGWIN !!!
515#
516
517
518AC_DEFUN([AC_COIN_PATCH_LIBTOOL_CYGWIN],
519[ case "$CXX" in
520    clang* | */clang*)
521	# do nothing but don't want to accidentally match the 'cl' patterns below
522	;;
523    cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*)
524      AC_MSG_NOTICE(Applying patches to libtool for cl compiler)
525      sed -e 's|fix_srcfile_path=\"`cygpath -w \"\$srcfile\"`\"|fix_srcfile_path=\"\\\`'"$CYGPATH_W"' \\\"\\$srcfile\\\"\\\`\"|' \
526          -e 's|fix_srcfile_path=\"\"|fix_srcfile_path=\"\\\`'"$CYGPATH_W"' \\\"\\$srcfile\\\"\\\`\"|' \
527          -e 's%compile_deplibs=\"\$dir/\$old_library \$compile_deplibs\"%compile_deplibs="'\`"$CYGPATH_W"' \$dir/\$old_library | sed -e '"'"'sY\\\\\\\\Y/Yg'"'"\`' \$compile_deplibs\"'% \
528          -e 's%compile_deplibs=\"\$dir/\$linklib \$compile_deplibs\"%compile_deplibs="'\`"$CYGPATH_W"' \$dir/\$linklib | sed -e '"'"'sY\\\\\\\\Y/Yg'"'"\`' \$compile_deplibs\"'% \
529          -e 's%lib /OUT:%lib -OUT:%' \
530          -e "s%cygpath -w%$CYGPATH_W%" \
531          -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%' \
532          -e 's/$AR t/lib -nologo -list/' \
533          -e 's%f_ex_an_ar_oldlib="\($?*1*\)"%f_ex_an_ar_oldlib='\`"$CYGPATH_W"' \1`%' \
534          -e 's%^archive_cmds=.*%archive_cmds="\\$CC -o \\$lib \\$libobjs \\$compiler_flags \\\\\\`echo \\\\\\"\\$deplibs\\\\\\" | \\$SED -e '"\'"'s/ -lc\\$//'"\'"'\\\\\\` -link -dll~linknames="%' \
535          -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"%' \
536      libtool > conftest.bla
537
538      mv conftest.bla libtool
539      chmod 755 libtool
540      ;;
541    *)
542      AC_MSG_NOTICE(Applying patches to libtool for GNU compiler)
543      sed -e 's|fix_srcfile_path=\"`cygpath -w \"\$srcfile\"`\"|fix_srcfile_path=\"\\\`'"$CYGPATH_W"' \\\"\\$srcfile\\\"\\\`\"|' \
544          -e 's|"lib /OUT:\\$oldlib\\$oldobjs\\$old_deplibs"|"\\$AR \\$AR_FLAGS \\$oldlib\\$oldobjs\\$old_deplibs~\\$RANLIB \\$oldlib"|' \
545          -e 's|libext="lib"|libext="a"|' \
546      libtool > conftest.bla
547
548      mv conftest.bla libtool
549      chmod 755 libtool
550      ;;
551  esac ]) # COIN_PATCH_LIBTOOL_CYGWIN
552
553
554# output
555AC_CONFIG_FILES(Makefile
556                ADOL-C/Makefile
557                ADOL-C/include/Makefile
558                ADOL-C/include/adolc/Makefile
559                ADOL-C/include/adolc/internal/adolc_settings.h
560                ADOL-C/include/adolc/drivers/Makefile
561                ADOL-C/include/adolc/internal/Makefile
562                ADOL-C/include/adolc/lie/Makefile
563                ADOL-C/include/adolc/sparse/Makefile
564                ADOL-C/include/adolc/tapedoc/Makefile
565                ADOL-C/src/Makefile
566                ADOL-C/src/drivers/Makefile
567                ADOL-C/src/lie/Makefile
568                ADOL-C/src/sparse/Makefile
569                ADOL-C/src/tapedoc/Makefile
570                ADOL-C/doc/version.tex
571                ADOL-C/examples/Makefile
572                ADOL-C/examples/additional_examples/Makefile
573                ADOL-C/examples/additional_examples/cuda/Makefile
574                ADOL-C/examples/additional_examples/clock/Makefile
575                ADOL-C/examples/additional_examples/checkpointing/Makefile
576                ADOL-C/examples/additional_examples/ext_diff_func/Makefile
577                ADOL-C/examples/additional_examples/fixpoint_exam/Makefile
578                ADOL-C/examples/additional_examples/hessmat/Makefile
579                ADOL-C/examples/additional_examples/lie/Makefile
580                ADOL-C/examples/additional_examples/lufact/Makefile
581                ADOL-C/examples/additional_examples/openmp_exam/Makefile
582                ADOL-C/examples/additional_examples/scal/Makefile
583                ADOL-C/examples/additional_examples/speelpenning/Makefile
584                ADOL-C/examples/additional_examples/taylor/Makefile
585                ADOL-C/examples/additional_examples/detexam/Makefile
586                ADOL-C/examples/additional_examples/helm/Makefile
587                ADOL-C/examples/additional_examples/lighthouse/Makefile
588                ADOL-C/examples/additional_examples/ode/Makefile
589                ADOL-C/examples/additional_examples/sparse/Makefile
590                ADOL-C/examples/additional_examples/tapesave/Makefile
591                ADOL-C/examples/additional_examples/pow/Makefile
592                ADOL-C/examples/additional_examples/timing/Makefile
593                ADOL-C/examples/additional_examples/param/Makefile
594                ADOL-C/test/Makefile
595                ADOL-C/swig/Makefile
596                MSVisualStudio/v14/sparse/config.h
597                MSVisualStudio/v14/nosparse/config.h
598                MSVisualStudio/v14/x64/sparse/config.h
599                MSVisualStudio/v14/x64/nosparse/config.h
600                adolc.spec
601                adolclib.pc
602)
603
604AC_OUTPUT
605
606#call libtool for cygwin
607AC_COIN_PATCH_LIBTOOL_CYGWIN
608warn=false
609# echo configuration
610echo \
611"
612-----------------------------------------------------------------------------
613Configuration:
614
615  C compiler:                         ${CC}
616  C++ compiler:                       ${CXX}
617  Linker:                             ${LD}
618  Source code location:               `pwd`
619  Install path:                       ${prefix}
620
621  CFLAGS:                             ${ac_adolc_cflags}
622  CXXFLAGS:                           ${ac_adolc_cxxflags}
623
624  Use Boost pool allocator:           ${using_boost_pool}
625  Use ADOL-C debug mode:              ${adolc_debug}
626  Use ADOL-C hard debug mode:         ${adolc_harddebug}
627  Zero value in adouble default ctor: ${adolc_stdczero}"
628
629if [[ "x${ac_adolc_openmpflag}" != "x" ]] ; then
630    echo \
631"  Access thread number via errno:     ${adolc_tserrno}"
632fi
633
634echo \
635"  Use ADOL-C activity tracking:       ${use_activities}
636  Use ADOL-C late init mode:          ${adolc_late_init}
637
638  Build sparse drivers:               ${sparse}
639  Build with adjoinable MPI support:  ${adolc_ampi_support}
640  Build with MediPack support:        ${adolc_medipack_support}
641  Build with ColPack:		      ${have_colpack}"
642if test x$sparse = xyes && test x$have_colpack = xno; then
643    echo -e \
644"  \033@<:@1;31mCompressed sparse structures will not be available
645  Only sparsity patterns can be computed\033@<:@0m"
646    warn=true
647fi
648if test x$sparse = xyes && test x$python_found = xyes && test x$SWIG != xno; then
649   echo \
650"  Build with python swig module:      yes"
651else
652   echo -n \
653"  Build with python swig module:      no "
654   if test x$sparse = xno && test x$python_found = xyes && test x$SWIG != xno; then
655     echo \
656"(due to sparse drivers disabled)"
657  elif test x$sparse = xyes && ( $test x$python_found = xno || test x$SWIG = xno ); then
658     echo \
659"(due to python/swig missing)"
660  else
661    echo \
662"(due to sparse drivers disabled and python/swig missing)"
663  fi
664fi
665echo
666
667echo \
668"  Build documented examples:          ${docexa}
669  Build additional examples:          ${addexa}
670  tape_doc routine computes values:   ${tapedoc_values}
671
672  See ADOL-C/src/config.h for further configuration information.
673-----------------------------------------------------------------------------"
674
675# check for make install problems resulting from missing write permission
676pdir=${prefix}
677writable=true
678while test "x${pdir}" != "x/" ; do
679    if test -e ${pdir} && test ! -w ${pdir}; then
680        writable=false
681        break
682    elif test ! -e ${pdir} ; then
683        pdir=`dirname ${pdir}`
684    else
685        break
686    fi
687done
688if test "x${pdir}" == "x/" ; then
689    writable=false
690fi
691if ! ${writable} ; then
692    echo -e \
693"  \033@<:@1;31mPrefix ${prefix} not writable
694  please run ./configure --prefix=DIR
695  with a writable directory path otherwise administrator privileges
696  will be required to run \`make install'\033@<:@0m"
697    warn=true
698fi
699
700case ${prefix} in
701   ${HOME}|${HOME}/*)
702if $warn ; then
703    for (( i=5; i>0; i-- )); do
704        echo -ne "\rPlease read the above messages carefully, continuing in ${i} seconds"
705        sleep 1
706    done
707    echo -e "\rPlease read the above messages carefully                                 "
708fi
709echo \
710"
711*****************************************************************************
712
713  To successfully compile and run programs using the ADOL-C shared library do
714  the following things:
715     compiling:
716        * add \"-I${prefix}/include\" to your compiler call
717     linking:
718        * add \"-L${libdir} -l$adolclib\" to your linker call
719        * extend your linker call by \"-Wl,--rpath -Wl,${libdir}\"
720          (if you wish to skip the point \"executing\")
721     executing (do one of the following things):
722        * add ${libdir} to your LD_LIBRARY_PATH variable
723        * ask your system administrator for adding ${libdir} to
724          the global file containing library search paths (/etc/ld.so.conf)
725
726     (or use the static library by replacing
727        \"-L${libdir} -l$adolclib\" with
728        \"${libdir}/lib$adolclib.a\" when linking)
729
730  See README for instructions on how to change to a nonlocal installation!
731
732*****************************************************************************
733"
734;;
735esac
736if test "x$enable_static" != "xno" ; then
737echo \
738" Linking a user program with a static ADOL-C library will always result
739  in a segmentation fault. Please always use the shared library.
740*****************************************************************************
741"
742fi
743