source: trunk/configure.ac @ 57

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

extended modified configure.ac with patch for cygwin libtool

  • Property svn:keywords set to Author Date Id Revision
File size: 13.8 KB
Line 
1##############################################################################
2# configure.ac -- Process this file with autoconf to produce configure
3# Revision: $Id: configure.ac 57 2009-11-17 19:09:54Z 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], [1])
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: 57 $)
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             AC_SUBST(ac_adolc_cflags)
205             AC_MSG_RESULT($ac_adolc_cflags)])
206
207AC_MSG_CHECKING(which CXXFLAGS to use)
208AC_ARG_WITH(cxxflags,
209            [AS_HELP_STRING([--with-cxxflags=FLAGS],
210                            [use CXXFLAGS=FLAGS (default: -O2)])],
211            [ac_adolc_cxxflags="$withval"
212             if test x${adolc_debug} == xyes ||
213                test x${adolc_harddebug} == xyes ; then
214                ac_adolc_cxxflags="$ac_adolc_cxxflags -g -O0"
215             fi
216             ac_adolc_cxxflags="$ac_adolc_cxxflags $ac_adolc_openmpflag"
217             AC_SUBST(ac_adolc_cxxflags)
218             AC_MSG_RESULT($ac_adolc_cxxflags)],
219            [if test "$ac_shell_cxxflags" = "not_set"; then
220                ac_adolc_cxxflags="-O2"
221                if test x${adolc_debug} == xyes ||
222                   test x${adolc_harddebug} == xyes ; then
223                   ac_adolc_cxxflags="-g -O0 -Wall"
224                fi
225             else
226                ac_adolc_cxxflags="$CXXFLAGS"
227             fi
228             ac_adolc_cxxflags="$ac_adolc_cxxflags $ac_adolc_openmpflag"
229             AC_SUBST(ac_adolc_cxxflags)
230             AC_MSG_RESULT($ac_adolc_cxxflags)])
231
232###########################################################################
233#                      COIN_PATCH_LIBTOOL_CYGWIN                          #
234###########################################################################
235
236# Patches to libtool for cygwin. Lots for cl, a few for GCC.
237# For cl:
238# - cygpath is not correctly quoted in fix_srcfile_path
239# - paths generated for .lib files is not run through cygpath -w
240
241
242AC_DEFUN([AC_COIN_PATCH_LIBTOOL_CYGWIN],
243[ case "$CXX" in
244    cl* | */cl* | CL* | */CL* | icl* | */icl* | ICL* | */ICL*)
245      AC_MSG_NOTICE(Applying patches to libtool for cl compiler)
246      sed -e 's|fix_srcfile_path=\"`cygpath -w \"\$srcfile\"`\"|fix_srcfile_path=\"\\\`'"$CYGPATH_W"' \\\"\\$srcfile\\\"\\\`\"|' \
247          -e 's|fix_srcfile_path=\"\"|fix_srcfile_path=\"\\\`'"$CYGPATH_W"' \\\"\\$srcfile\\\"\\\`\"|' \
248          -e 's%compile_deplibs=\"\$dir/\$old_library \$compile_deplibs\"%compile_deplibs="'\`"$CYGPATH_W"' \$dir/\$old_library | sed -e '"'"'sY\\\\\\\\Y/Yg'"'"\`' \$compile_deplibs\"'% \
249          -e 's%compile_deplibs=\"\$dir/\$linklib \$compile_deplibs\"%compile_deplibs="'\`"$CYGPATH_W"' \$dir/\$linklib | sed -e '"'"'sY\\\\\\\\Y/Yg'"'"\`' \$compile_deplibs\"'% \
250          -e 's%lib /OUT:%lib -OUT:%' \
251          -e "s%cygpath -w%$CYGPATH_W%" \
252          -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%' \
253          -e 's/$AR t/lib -nologo -list/' \
254          -e 's%f_ex_an_ar_oldlib="\($?*1*\)"%f_ex_an_ar_oldlib='\`"$CYGPATH_W"' \1`%' \
255          -e 's%^archive_cmds=.*%archive_cmds="\\$CC -o \\$lib \\$libobjs \\$compiler_flags \\\\\\`echo \\\\\\"\\$deplibs\\\\\\" | \\$SED -e '"\'"'s/ -lc\\$//'"\'"'\\\\\\` -link -dll~linknames="%' \
256          -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"%' \
257      libtool > conftest.bla
258
259      mv conftest.bla libtool
260      chmod 755 libtool
261      ;;
262    *)
263      AC_MSG_NOTICE(Applying patches to libtool for GNU compiler)
264      sed -e 's|fix_srcfile_path=\"`cygpath -w \"\$srcfile\"`\"|fix_srcfile_path=\"\\\`'"$CYGPATH_W"' \\\"\\$srcfile\\\"\\\`\"|' \
265          -e 's|"lib /OUT:\\$oldlib\\$oldobjs\\$old_deplibs"|"\\$AR \\$AR_FLAGS \\$oldlib\\$oldobjs\\$old_deplibs~\\$RANLIB \\$oldlib"|' \
266          -e 's|libext="lib"|libext="a"|' \
267      libtool > conftest.bla
268
269      mv conftest.bla libtool
270      chmod 755 libtool
271      ;;
272  esac ]) # COIN_PATCH_LIBTOOL_CYGWIN
273
274
275# output
276AC_CONFIG_FILES(Makefile
277                ADOL-C/Makefile
278                ADOL-C/src/Makefile
279                ADOL-C/src/drivers/Makefile
280                ADOL-C/src/sparse/Makefile
281                ADOL-C/src/tapedoc/Makefile
282                ADOL-C/examples/Makefile
283                ADOL-C/examples/additional_examples/Makefile
284                ADOL-C/examples/additional_examples/clock/Makefile
285                ADOL-C/examples/additional_examples/checkpointing/Makefile
286                ADOL-C/examples/additional_examples/ext_diff_func/Makefile
287                ADOL-C/examples/additional_examples/fixpoint_exam/Makefile
288                ADOL-C/examples/additional_examples/hessmat/Makefile
289                ADOL-C/examples/additional_examples/lufact/Makefile
290                ADOL-C/examples/additional_examples/openmp_exam/Makefile
291                ADOL-C/examples/additional_examples/scal/Makefile
292                ADOL-C/examples/additional_examples/speelpenning/Makefile
293                ADOL-C/examples/additional_examples/taylor/Makefile
294                ADOL-C/examples/additional_examples/detexam/Makefile
295                ADOL-C/examples/additional_examples/helm/Makefile
296                ADOL-C/examples/additional_examples/lighthouse/Makefile
297                ADOL-C/examples/additional_examples/ode/Makefile
298                ADOL-C/examples/additional_examples/sparse/Makefile
299                ADOL-C/examples/additional_examples/tapesave/Makefile
300                ADOL-C/examples/additional_examples/pow/Makefile
301                ADOL-C/examples/additional_examples/timing/Makefile)
302
303AC_OUTPUT
304
305#call libtool for cygwin
306AC_COIN_PATCH_LIBTOOL_CYGWIN
307
308
309# echo configuration
310echo \
311"
312-----------------------------------------------------------------------------
313Configuration:
314
315  C compiler:                       ${CC}
316  C++ compiler:                     ${CXX}
317  Linker:                           ${LD}
318  Source code location:             `pwd`
319  Install path:                     ${prefix}
320 
321  CFLAGS:                           ${ac_adolc_cflags}
322  CXXFLAGS:                         ${ac_adolc_cxxflags}
323
324  Use ADOL-C debug mode:            ${adolc_debug}
325  Use ADOL-C hard debug mode:       ${adolc_harddebug}
326  Use ADOL-C adouble zeroing mode:  ${adolc_stdczero}"
327
328if [[ "x${ac_adolc_openmpflag}" != "x" ]] ; then
329    echo \
330"  Access thread number via errno:   ${adolc_tserrno}"
331fi
332
333echo \
334"  Use ADOL-C safe extern mode:      ${adolc_safe_extern}
335
336  Build sparse drivers:             ${sparse}
337
338  Build documented examples:        ${docexa}
339  Build additional examples:        ${addexa}
340
341  See ADOL-C/src/config.h for further configuration information.
342-----------------------------------------------------------------------------"
343
344# check for make install problems resulting from missing write permission
345if test x${prefix} == x${HOME}/adolc_base ; then
346echo \
347"
348*****************************************************************************
349
350  To successfully compile and run programs using the ADOL-C shared library do
351  the following things:
352     compiling:
353        * add \"-I\${HOME}/adolc_base/include\" to your compiler call
354     linking:
355        * add \"-L\${HOME}/adolc_base/lib -ladolc\" to your linker call
356        * extend your linker call by \"-Wl,--rpath -Wl,\${HOME}/adolc_base/lib\"
357          (if you wish to skip the point \"executing\")
358     executing (do one of the following things):
359        * add \${HOME}/adolc_base/lib to your LD_LIBRARY_PATH variable
360        * ask your system administrator for adding \${HOME}/adolc_base/lib to
361          the global file containing library search paths (/etc/ld.so.conf)
362
363     (or use the static library by replacing
364        \"-L\${HOME}/adolc_base/lib -ladolc\" with
365        \"\${HOME}/adolc_base/lib/libadolc.a\" when linking)
366
367  See README for instructions on how to change to a nonlocal installation!
368
369*****************************************************************************
370"
371fi
Note: See TracBrowser for help on using the repository browser.