source: stable/2.1/configure.ac @ 91

Last change on this file since 91 was 91, checked in by awalther, 10 years ago

mergestable version 2.1 with revision 89

  • Property svn:keywords set to Author Date Id Revision
File size: 14.0 KB
Line 
1##############################################################################
2# configure.ac -- Process this file with autoconf to produce configure
3# Revision: $Id: configure.ac 91 2010-02-24 07:56:58Z awalther $
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], [1])
12define([ADOLC_LVL], [3])
13
14AC_PREREQ(2.57)
15AC_INIT(adolc,
16        ADOLC_VER.ADOLC_SUB.ADOLC_LVL-trunk,
17        [adol-c@list.coin-or.org])
18AC_REVISION($Revision: 91 $)
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
24
25if test x$CFLAGS == x ; then
26    ac_shell_cflags="not_set"
27else
28    ac_shell_cflags="$CFLAGS"
29fi
30if test x$CXXFLAGS == x ; then
31    ac_shell_cxxflags="not_set"
32else
33    ac_shell_cxxflags="$CXXFLAGS"
34fi
35
36# checks for programs
37AC_PROG_CXX
38AC_PROG_CC
39AC_PROG_CPP
40AC_PROG_INSTALL
41AC_PROG_LN_S
42AC_PROG_MAKE_SET
43AC_PROG_RANLIB
44AC_LIBTOOL_WIN32_DLL
45AC_PROG_LIBTOOL
46
47# checks for header files
48AC_HEADER_STDC
49AC_HEADER_TIME
50AC_HEADER_STDBOOL
51AC_CHECK_HEADERS([stddef.h stdlib.h stdio.h string.h unistd.h sys/timeb.h])
52
53# checks for types
54AC_C_CONST
55AC_C_INLINE
56AC_TYPE_SIZE_T
57AC_STRUCT_TM
58
59# Checks for library functions
60AC_FUNC_MALLOC
61AC_FUNC_REALLOC
62AC_CHECK_FUNCS([floor ftime pow sqrt strchr strtol])
63
64# substitutions
65AC_SUBST(ac_aux_dir)
66
67# Checks for libraries
68AC_CHECK_LIB([m], [pow])
69
70# ADOL-C configuration
71AC_DEFINE(ADOLC_VERSION,ADOLC_VER,[ADOL-C Version])
72AC_DEFINE(ADOLC_SUBVERSION,ADOLC_SUB,[ADOL-C Subversion])
73AC_DEFINE(ADOLC_PATCHLEVEL,ADOLC_LVL,[ADOL-C Patchlevel])
74
75AC_MSG_CHECKING(whether to use ADOL-C debug mode)
76AC_ARG_ENABLE(debug,
77              [
78AS_HELP_STRING([--enable-debug],[enable ADOL-C debug mode [default=no]])],
79  [AC_DEFINE(ADOLC_DEBUG,1,[ADOL-C debug mode])
80   AC_MSG_RESULT(yes)
81   adolc_debug="yes"],
82  [AC_MSG_RESULT(no)
83   adolc_debug="no"])
84
85AC_MSG_CHECKING(whether to use ADOL-C hard debug mode)
86AC_ARG_ENABLE(harddebug,
87              [
88AS_HELP_STRING([--enable-harddebug],[enable ADOL-C hard debug mode
89 [default=no]])],
90  [AC_DEFINE(ADOLC_HARDDEBUG,1,[ADOL-C hard debug mode])
91   AC_DEFINE(ADOLC_DEBUG,1,[ADOL-C debug mode])
92   AC_MSG_RESULT(yes)
93   adolc_harddebug="yes"],
94  [AC_MSG_RESULT(no)
95   adolc_harddebug="no"])
96
97AC_MSG_CHECKING(whether standard adouble constructor shall zero value)
98AC_ARG_ENABLE(stdczero,
99              [
100AS_HELP_STRING([--enable-stdczero],[adouble standard constructor zeros value
101(at the cost of performance) [default=no]])],
102  [AC_DEFINE(ADOLC_ADOUBLE_STDCZERO,1,[ADOL-C adouble zeroing mode])
103   AC_MSG_RESULT(yes)
104   adolc_stdczero="yes"],
105  [AC_MSG_RESULT(no)
106   adolc_stdczero="no"])
107
108AC_MSG_CHECKING(whether errno is thread save)
109AC_ARG_ENABLE(tserrno,
110              [
111AS_HELP_STRING([--enable-tserrno],[use errno as thread number cache [default=no]])],
112  [AC_DEFINE(ADOLC_THREADSAVE_ERRNO,1,[ADOL-C thread save errno mode])
113   AC_MSG_RESULT(yes)
114   adolc_tserrno="yes"],
115  [AC_MSG_RESULT(no)
116   adolc_tserrno="no"])
117
118AC_MSG_CHECKING(whether external function call forces backup of all adoubles)
119AC_ARG_ENABLE(safe_extern,
120              [
121AS_HELP_STRING([--enable-safe-extern],[backup all adoubles before calling an external function [default=no]])],
122  [AC_DEFINE(ADOLC_SAFE_EXTERN,1,[ADOL-C safe extern mode])
123   AC_MSG_RESULT(yes)
124   adolc_safe_extern="yes"],
125  [AC_MSG_RESULT(no)
126   adolc_safe_extern="no"])
127
128# ADOL-C Sparse facility
129AC_MSG_CHECKING(whether to build sparse drivers)
130AC_ARG_WITH(sparse,
131            [
132AS_HELP_STRING([--with-sparse],[build sparse drivers [default=no]])],
133            [sparse="yes"
134             AC_MSG_RESULT(yes)],
135            [sparse="no"
136             AC_MSG_RESULT(no)])
137AM_CONDITIONAL(SPARSE,[test x${sparse} = xyes])
138
139# ADOL-C Examples
140AC_MSG_CHECKING(whether to build documented examples)
141AC_ARG_WITH(docexa,
142            [
143AS_HELP_STRING([--with-docexa],[build documented examples [default=no]])],
144            [docexa="yes"
145             AC_MSG_RESULT(yes)],
146            [docexa="no"
147             AC_MSG_RESULT(no)])
148AM_CONDITIONAL(DOCEXA,[test x${docexa} = xyes])
149
150AC_MSG_CHECKING(whether to build additional examples)
151AC_ARG_WITH(addexa,
152            [AS_HELP_STRING([--with-addexa],
153                            [build additional examples [default=no]])],
154            [addexa="yes"
155             AC_MSG_RESULT(yes)],
156            [addexa="no"
157             AC_MSG_RESULT(no)])
158AM_CONDITIONAL(ADDEXA,[test x${addexa} = xyes])
159
160AC_MSG_CHECKING(whether to build parallel example)
161AC_ARG_WITH(parexa,
162            [AS_HELP_STRING([--with-parexa],
163                            [build parallel example [default=no], if yes -with-openmp-flag=FLAG required])],
164            [parexa="yes"
165             AC_MSG_RESULT(yes)],
166            [parexa="no"
167             AC_MSG_RESULT(no)])
168AM_CONDITIONAL(PAREXA,[test x${parexa} = xyes])
169
170# ADOL-C Compilation flags
171AC_MSG_CHECKING(which flag to use to enable OpenMP)
172AC_ARG_WITH(openmp-flag,
173            [AS_HELP_STRING([--with-openmp-flag=FLAG],
174                            [use FLAG to enable OpenMP at compile time [default=none]])],
175            [ac_adolc_openmpflag=$withval
176             msg_result=$withval
177             AC_MSG_RESULT($ac_adolc_openmpflag)],
178            [ac_adolc_openmpflag=""
179             msg_result="none"
180             AC_MSG_RESULT($ac_adolc_openmpflag)])
181
182AC_MSG_CHECKING(which CFLAGS to use)
183AC_ARG_WITH(cflags,
184            [AS_HELP_STRING([--with-cflags=FLAGS],
185                            [use CFLAGS=FLAGS (default: -O2)])],
186            [ac_adolc_cflags="$withval"
187             if test x${adolc_debug} == xyes ||
188                test x${adolc_harddebug} == xyes ; then
189                ac_adolc_cflags="$ac_adolc_cflags -g -O0"
190             fi
191             ac_adolc_cflags="$ac_adolc_cflags $ac_adolc_openmpflag"
192             AC_SUBST(ac_adolc_cflags)
193             AC_MSG_RESULT($ac_adolc_cflags)],
194            [if test "$ac_shell_cflags" = "not_set"; then
195                ac_adolc_cflags="-O2"
196                if test x${adolc_debug} == xyes ||
197                   test x${adolc_harddebug} == xyes ; then
198                   ac_adolc_cflags="-g -O3 -Wall -ansi"
199                fi
200             else
201                ac_adolc_cflags="$CFLAGS"
202             fi
203             ac_adolc_cflags="$ac_adolc_cflags $ac_adolc_openmpflag"
204
205             AC_SUBST(ac_adolc_cflags)
206             AC_MSG_RESULT($ac_adolc_cflags)])
207
208AC_MSG_CHECKING(which CXXFLAGS to use)
209AC_ARG_WITH(cxxflags,
210            [AS_HELP_STRING([--with-cxxflags=FLAGS],
211                            [use CXXFLAGS=FLAGS (default: -O2)])],
212            [ac_adolc_cxxflags="$withval"
213             if test x${adolc_debug} == xyes ||
214                test x${adolc_harddebug} == xyes ; then
215                ac_adolc_cxxflags="$ac_adolc_cxxflags -g -O0"
216             fi
217             ac_adolc_cxxflags="$ac_adolc_cxxflags $ac_adolc_openmpflag"
218             AC_SUBST(ac_adolc_cxxflags)
219             AC_MSG_RESULT($ac_adolc_cxxflags)],
220            [if test "$ac_shell_cxxflags" = "not_set"; then
221                ac_adolc_cxxflags="-O2"
222                if test x${adolc_debug} == xyes ||
223                   test x${adolc_harddebug} == xyes ; then
224                   ac_adolc_cxxflags="-g -O0 -Wall"
225                fi
226             else
227                ac_adolc_cxxflags="$CXXFLAGS"
228             fi
229             ac_adolc_cxxflags="$ac_adolc_cxxflags $ac_adolc_openmpflag"
230            AC_SUBST(ac_adolc_cxxflags)
231             AC_MSG_RESULT($ac_adolc_cxxflags)])
232
233###########################################################################
234#                      COIN_PATCH_LIBTOOL_CYGWIN                          #
235###########################################################################
236
237# Patches to libtool for cygwin. Lots for cl, a few for GCC.
238# For cl:
239# - cygpath is not correctly quoted in fix_srcfile_path
240# - paths generated for .lib files is not run through cygpath -w
241
242#
243# REQUIRED FOR COMPILATION WITH CYGWIN !!!
244#
245 
246
247AC_DEFUN([AC_COIN_PATCH_LIBTOOL_CYGWIN],
248[ case "$CXX" in
249    cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*)
250      AC_MSG_NOTICE(Applying patches to libtool for cl compiler)
251      sed -e 's|fix_srcfile_path=\"`cygpath -w \"\$srcfile\"`\"|fix_srcfile_path=\"\\\`'"$CYGPATH_W"' \\\"\\$srcfile\\\"\\\`\"|' \
252          -e 's|fix_srcfile_path=\"\"|fix_srcfile_path=\"\\\`'"$CYGPATH_W"' \\\"\\$srcfile\\\"\\\`\"|' \
253          -e 's%compile_deplibs=\"\$dir/\$old_library \$compile_deplibs\"%compile_deplibs="'\`"$CYGPATH_W"' \$dir/\$old_library | sed -e '"'"'sY\\\\\\\\Y/Yg'"'"\`' \$compile_deplibs\"'% \
254          -e 's%compile_deplibs=\"\$dir/\$linklib \$compile_deplibs\"%compile_deplibs="'\`"$CYGPATH_W"' \$dir/\$linklib | sed -e '"'"'sY\\\\\\\\Y/Yg'"'"\`' \$compile_deplibs\"'% \
255          -e 's%lib /OUT:%lib -OUT:%' \
256          -e "s%cygpath -w%$CYGPATH_W%" \
257          -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%' \
258          -e 's/$AR t/lib -nologo -list/' \
259          -e 's%f_ex_an_ar_oldlib="\($?*1*\)"%f_ex_an_ar_oldlib='\`"$CYGPATH_W"' \1`%' \
260          -e 's%^archive_cmds=.*%archive_cmds="\\$CC -o \\$lib \\$libobjs \\$compiler_flags \\\\\\`echo \\\\\\"\\$deplibs\\\\\\" | \\$SED -e '"\'"'s/ -lc\\$//'"\'"'\\\\\\` -link -dll~linknames="%' \
261          -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"%' \
262      libtool > conftest.bla
263
264      mv conftest.bla libtool
265      chmod 755 libtool
266      ;;
267    *)
268      AC_MSG_NOTICE(Applying patches to libtool for GNU compiler)
269      sed -e 's|fix_srcfile_path=\"`cygpath -w \"\$srcfile\"`\"|fix_srcfile_path=\"\\\`'"$CYGPATH_W"' \\\"\\$srcfile\\\"\\\`\"|' \
270          -e 's|"lib /OUT:\\$oldlib\\$oldobjs\\$old_deplibs"|"\\$AR \\$AR_FLAGS \\$oldlib\\$oldobjs\\$old_deplibs~\\$RANLIB \\$oldlib"|' \
271          -e 's|libext="lib"|libext="a"|' \
272      libtool > conftest.bla
273
274      mv conftest.bla libtool
275      chmod 755 libtool
276      ;;
277  esac ]) # COIN_PATCH_LIBTOOL_CYGWIN
278 
279
280
281# output
282AC_CONFIG_FILES(Makefile
283                ADOL-C/Makefile
284                ADOL-C/src/Makefile
285                ADOL-C/src/drivers/Makefile
286                ADOL-C/src/sparse/Makefile
287                ADOL-C/src/tapedoc/Makefile
288                ADOL-C/examples/Makefile
289                ADOL-C/examples/additional_examples/Makefile
290                ADOL-C/examples/additional_examples/clock/Makefile
291                ADOL-C/examples/additional_examples/checkpointing/Makefile
292                ADOL-C/examples/additional_examples/ext_diff_func/Makefile
293                ADOL-C/examples/additional_examples/fixpoint_exam/Makefile
294                ADOL-C/examples/additional_examples/hessmat/Makefile
295                ADOL-C/examples/additional_examples/lufact/Makefile
296                ADOL-C/examples/additional_examples/openmp_exam/Makefile
297                ADOL-C/examples/additional_examples/scal/Makefile
298                ADOL-C/examples/additional_examples/speelpenning/Makefile
299                ADOL-C/examples/additional_examples/taylor/Makefile
300                ADOL-C/examples/additional_examples/detexam/Makefile
301                ADOL-C/examples/additional_examples/helm/Makefile
302                ADOL-C/examples/additional_examples/lighthouse/Makefile
303                ADOL-C/examples/additional_examples/ode/Makefile
304                ADOL-C/examples/additional_examples/sparse/Makefile
305                ADOL-C/examples/additional_examples/tapesave/Makefile
306                ADOL-C/examples/additional_examples/pow/Makefile
307                ADOL-C/examples/additional_examples/timing/Makefile
308                ADOL-C/test/Makefile)
309
310AC_OUTPUT
311
312#call libtool for cygwin
313AC_COIN_PATCH_LIBTOOL_CYGWIN
314
315# echo configuration
316echo \
317"
318-----------------------------------------------------------------------------
319Configuration:
320
321  C compiler:                       ${CC}
322  C++ compiler:                     ${CXX}
323  Linker:                           ${LD}
324  Source code location:             `pwd`
325  Install path:                     ${prefix}
326 
327  CFLAGS:                           ${ac_adolc_cflags}
328  CXXFLAGS:                         ${ac_adolc_cxxflags}
329
330  Use ADOL-C debug mode:            ${adolc_debug}
331  Use ADOL-C hard debug mode:       ${adolc_harddebug}
332  Use ADOL-C adouble zeroing mode:  ${adolc_stdczero}"
333
334if [[ "x${ac_adolc_openmpflag}" != "x" ]] ; then
335    echo \
336"  Access thread number via errno:   ${adolc_tserrno}"
337fi
338
339echo \
340"  Use ADOL-C safe extern mode:      ${adolc_safe_extern}
341
342  Build sparse drivers:             ${sparse}
343
344  Build documented examples:        ${docexa}
345  Build additional examples:        ${addexa}
346
347  See ADOL-C/src/config.h for further configuration information.
348-----------------------------------------------------------------------------"
349
350# check for make install problems resulting from missing write permission
351if test x${prefix} == x${HOME}/adolc_base ; then
352echo \
353"
354*****************************************************************************
355
356  To successfully compile and run programs using the ADOL-C shared library do
357  the following things:
358     compiling:
359        * add \"-I\${HOME}/adolc_base/include\" to your compiler call
360     linking:
361        * add \"-L\${HOME}/adolc_base/lib -ladolc\" to your linker call
362        * extend your linker call by \"-Wl,--rpath -Wl,\${HOME}/adolc_base/lib\"
363          (if you wish to skip the point \"executing\")
364     executing (do one of the following things):
365        * add \${HOME}/adolc_base/lib to your LD_LIBRARY_PATH variable
366        * ask your system administrator for adding \${HOME}/adolc_base/lib to
367          the global file containing library search paths (/etc/ld.so.conf)
368
369     (or use the static library by replacing
370        \"-L\${HOME}/adolc_base/lib -ladolc\" with
371        \"\${HOME}/adolc_base/lib/libadolc.a\" when linking)
372
373  See README for instructions on how to change to a nonlocal installation!
374
375*****************************************************************************
376"
377fi
Note: See TracBrowser for help on using the repository browser.