source: trunk/configure.ac @ 3788

Last change on this file since 3788 was 3788, checked in by bradbell, 4 years ago

merge to branch: trunk
from repository: https://github.com/coin-or/CppAD
start hash code: c4559d5e01e1b0f09943490dd84449557eced25d
end hash code: 431e0a227dbfe6172d265d9d79a2b5b258c5bc18

commit 431e0a227dbfe6172d265d9d79a2b5b258c5bc18
Author: Brad Bell <bradbell@…>
Date: Tue Feb 9 07:41:29 2016 -0700

  1. Change package.sh to automatically update version on (master branch only).
  2. Change version.sh copy to check and change.

commit a14455414810cfe3c3e4bca90090defc2528a353
Author: Brad Bell <bradbell@…>
Date: Tue Feb 9 06:19:54 2016 -0700

Change check_verbatim to check_srcfile
because all but one of the verbatim commands were changed to srcfile commands.


check_include_omh.sh: old check that file names did not change case (for cygwin development).

commit 4ce45b796b57629332ab46d8ae6df94e0a1ed998
Author: Brad Bell <bradbell@…>
Date: Tue Feb 9 06:04:57 2016 -0700

batch_edit.sh to change $verbatim and $codep to $srcfile and $srccode.


det_by_minor.c: remove some invisible white space.

commit 56553b88c9623c30d2222425a9640b95ce4c8281
Author: Brad Bell <bradbell@…>
Date: Mon Feb 8 18:01:49 2016 -0700

check_jenkins.sh: jenkins.sh no longer takes an argument.
jenkins.sh: fix name of script in error message.

commit 3b8a208cfc7e8ef3c928c17eb291aa3b90ff0050
Author: Brad Bell <bradbell@…>
Date: Mon Feb 8 07:57:02 2016 -0700

new_release.sh: track branches in comments, back to master at OK end, first check of response.

commit 442b7cbc45c022776e8257d3c3404dccdd06c420
Author: Brad Bell <bradbell@…>
Date: Mon Feb 8 06:01:11 2016 -0700

  1. Advance to release 20160000.1.
  2. Check using master version of new_release.sh.
  3. Make sure auto-tools version up to date.
  4. Ask user if doing further testing before commiting new release.

commit f7bdd1f48e72feb05d604da63914022809f45c28
Author: Brad Bell <bradbell@…>
Date: Sun Feb 7 07:59:41 2016 -0700

Add shared library version number to cppad_lib; i.e., cppad_lib.yyyy.mmdd.rel

commit a4c716552e3ad05b337aea58b643c9ad1cbcd4ac
Author: Brad Bell <bradbell@…>
Date: Sun Feb 7 05:25:39 2016 -0700

Make cppad_lib libarary conditional on colpack_prefix being specified.

commit 5e8890eb8de8b0cde146a6ed59c391d7c355ff24
Author: Brad Bell <bradbell@…>
Date: Tue Jan 26 10:49:37 2016 -0700

vector.hpp: fix The -> This.

commit e4e5442b069d7b00e197c31616da32eee20460b3
Merge: c4559d5 ed28b89
Author: Brad Bell <bradbell@…>
Date: Tue Jan 26 09:47:58 2016 -0700

Merge pull request #14 from barak/master


fix spelling in description of cppad_profile_flag on cmake command line

commit ed28b899c9fedab52a578aa7dd73818638081fe6
Author: Barak A. Pearlmutter <barak+git@…>
Date: Tue Jan 26 16:24:32 2016 +0000

typo

  • Property svn:keywords set to Id
File size: 24.5 KB
Line 
1dnl $Id: configure.ac 3788 2016-02-09 15:50:06Z bradbell $
2dnl ---------------------------------------------------------------------------
3dnl CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-16 Bradley M. Bell
4dnl
5dnl CppAD is distributed under multiple licenses. This distribution is under
6dnl the terms of the
7dnl                     Eclipse Public License Version 1.0.
8dnl
9dnl A copy of this license is included in the COPYING file of this distribution.
10dnl Please visit http://www.coin-or.org/CppAD/ for information on other licenses.
11dnl ---------------------------------------------------------------------------
12dnl
13dnl Process this file with autoconf to produce a configure script.
14dnl   package   version              bug-report
15AC_INIT([cppad], [20160209], [cppad@list.coin-or.org])
16AM_SILENT_RULES([yes])
17
18dnl By defalut disable maintainer mode when running configure;
19dnl --enable-maintainer-mode will enable it.
20dnl This avoids the autoconf and automake tools being launched by make
21AM_MAINTAINER_MODE
22
23dnl Set the default install prefix to the installers home directory
24dnl cygwin begin delete:
25AC_PREFIX_DEFAULT(${HOME})
26dnl cygwin end delete:
27dnl cygwin replace: AC_PREFIX_DEFAULT(/usr)
28
29dnl Run any macros required for proper operation of generated makefiles
30dnl nostdinc: Do not define standard include directories in generated makefiles
31dnl Note this must come before AC_PROG_CC; see
32dnl http://lists.gnu.org/archive/html/automake/2010-08/msg00113.html
33AM_INIT_AUTOMAKE([nostdinc subdir-objects -Wall])
34
35# check if we have ar program
36have_ar='yes'
37AM_PROG_AR([have_ar='no'])
38AC_MSG_NOTICE([have_ar = $have_ar])
39
40dnl ----------------------------------------------------------------------
41AC_MSG_NOTICE([*** Check command line arguments that are longer used ****])
42
43if test "$CPP_ERROR_WARN" != "" ; then
44    AC_MSG_ERROR([The CPP_ERROR_WARN configure option is now CXX_FLAGS])
45fi
46dnl
47AC_ARG_WITH(SpeedExample, AC_HELP_STRING(
48        [--with-SpeedExample], [is not necessary, see install instructions.]),
49        [SpeedExample="yes"], [SpeedExample="no"]
50)
51if test "$SpeedExample" = "yes" ; then
52    AC_MSG_ERROR([--with-SpeedExample not necessary, see install instructions.])
53fi
54dnl
55AC_ARG_WITH(profiling, AC_HELP_STRING(
56        [--with-profiling], [is not necessary, see install instructions.]),
57        [profiling="yes"], [profiling="no"]
58)
59if test "$profiling" = "yes" ; then
60    AC_MSG_ERROR([--with-profiling not necessary, see install instructions.])
61fi
62dnl
63AC_ARG_WITH(Speed, AC_HELP_STRING(
64        [--with-Speed], [is not necessary, see install instructions.]),
65        [Speed="yes"], [Speed="no"]
66)
67if test "$Speed" = "yes" ; then
68    AC_MSG_ERROR([--with-Speed not necessary, see install instructions.])
69fi
70dnl
71AC_ARG_WITH(Introduction, AC_HELP_STRING(
72        [--with-Introduction], [is not necessary, see install instructions.]),
73        [Introduction="yes"], [Introduction="no"]
74)
75if test "$Introduction" = "yes" ; then
76    AC_MSG_ERROR([--with-Introduction not necessary, see install instructions.])
77fi
78dnl
79AC_ARG_WITH(Example, AC_HELP_STRING(
80        [--with-Example], [is not necessary, see install instructions.]),
81        [Example="yes"], [Example="no"]
82)
83if test "$Example" = "yes" ; then
84    AC_MSG_ERROR([--with-Example not necessary, see install instructions.])
85fi
86dnl
87AC_ARG_WITH(TestMore, AC_HELP_STRING(
88        [--with-TestMore], [is not necessary, see install instructions.]),
89        [TestMore="yes"], [TestMore="no"]
90)
91if test "$TestMore" = "yes" ; then
92    AC_MSG_ERROR([--with-TestMore not necessary, see install instructions.])
93fi
94dnl
95AC_ARG_WITH(PrintFor, AC_HELP_STRING(
96        [--with-PrintFor], [is not necessary, see install instructions.]),
97        [PrintFor="yes"], [PrintFor="no"]
98)
99if test "$PrintFor" = "yes" ; then
100    AC_MSG_ERROR([--with-PrintFor not necessary, see install instructions.])
101fi
102dnl --------------------------------------------------------------------------
103AC_MSG_NOTICE([******  Check command line arguments that are used ***********])
104
105dnl -----------------------------------------------------------------------
106dnl The case where enable_msvc != no is defined and supported by Ted Ralphs
107AC_MSG_CHECKING([--enable-msvc])
108AC_ARG_ENABLE([msvc],
109  [AC_HELP_STRING([--enable-msvc],
110                  [Prefer (i)cl/ifort/link over GNU on MinGW/Cygwin.])],
111  [enable_msvc=$enableval],
112  [enable_msvc=no]
113)
114AC_MSG_RESULT([$enable_msvc])
115
116
117dnl the prefix directory corresponding to CppAD -------------------------
118dnl The following seems to work but NONE is not in autoconf specifications
119AC_MSG_CHECKING([--prefix])
120if test "$prefix" = "NONE" ; then
121        AC_MSG_RESULT([$HOME])
122else
123        AC_MSG_RESULT([$prefix])
124fi
125
126dnl Are we installing the documentation -----------------------------------
127dnl cygwin begin delete:
128AC_MSG_CHECKING([--with-Documentation])
129AC_ARG_WITH(Documentation,
130        AC_HELP_STRING([--with-Documentation], [default is no]),
131        [Documentation="yes"],
132        [Documentation="no"]
133)
134AM_CONDITIONAL(CppAD_DOCUMENTATION, test "$Documentation" = "yes")
135AC_MSG_RESULT([$Documentation])
136dnl cygwin end delete:
137dnl cygwin replace: AM_CONDITIONAL(CppAD_DOCUMENTATION, test "yes" = "yes")
138
139dnl Are we using standard vectors ----------------------------------------
140AC_MSG_CHECKING([--with-stdvector])
141AC_ARG_WITH(stdvector,
142        AC_HELP_STRING([--with-stdvector], [default is no]),
143        [stdvector="yes"],
144        [stdvector="no"]
145)
146if test "$stdvector" = "yes" ; then
147        AC_SUBST(cppad_stdvector, 1)
148else
149        AC_SUBST(cppad_stdvector, 0)
150fi
151AC_MSG_RESULT([$stdvector])
152
153dnl Are we using boost vectors ----------------------------------------
154AC_MSG_CHECKING([--with-boostvector])
155AC_ARG_WITH(boostvector,
156        AC_HELP_STRING([--with-boostvector], [default is no]),
157        [boostvector="yes"],
158        [boostvector="no"]
159)
160AC_MSG_RESULT([$boostvector])
161if test "$boostvector" = "yes" ; then
162        if test "$stdvector" != "no" ; then
163                AC_MSG_ERROR([cannot --with both stdvector and boostvector])
164        fi
165        AC_SUBST(cppad_boostvector, 1)
166else
167        AC_SUBST(cppad_boostvector, 0)
168fi
169
170dnl Are we using eigen vectors ----------------------------------------
171AC_MSG_CHECKING([--with-eigenvector])
172AC_ARG_WITH(eigenvector,
173        AC_HELP_STRING([--with-eigenvector], [default is no]),
174        [eigenvector="yes"],
175        [eigenvector="no"]
176)
177AC_MSG_RESULT([$eigenvector])
178if test "$eigenvector" = "yes" ; then
179        if test "$stdvector" != "no" ; then
180                AC_MSG_ERROR([cannot --with both stdvector and eigenvector])
181        fi
182        if test "$boostvector" != "no" ; then
183                AC_MSG_ERROR([cannot --with both boostvector and eigenvector])
184        fi
185        AC_SUBST(cppad_eigenvector, 1)
186else
187        AC_SUBST(cppad_eigenvector, 0)
188fi
189
190dnl Are we using sparse_set or sparse_list ----------------------------
191AC_MSG_CHECKING([--with-sparse_set])
192AC_ARG_WITH(sparse_set,
193        AC_HELP_STRING([--with-sparse_set], [default is not specified]),
194        [sparse_set="yes"],
195        [sparse_set="no"]
196)
197AC_MSG_RESULT([$sparse_set])
198dnl
199AC_MSG_CHECKING([--with-sparse_list])
200AC_ARG_WITH(sparse_list,
201        AC_HELP_STRING([--with-sparse_list], [default is not specified]),
202        [sparse_list="yes"],
203        [sparse_list="no"]
204)
205AC_MSG_RESULT([$sparse_list])
206if test "$sparse_set" = "yes" ; then
207        if test "$sparse_list" == "yes" ; then
208                AC_MSG_ERROR([cannot --with both sparse_set and sparse_list])
209        fi
210        AC_SUBST(cppad_internal_sparse_set, sparse_set)
211else
212        AC_SUBST(cppad_internal_sparse_set, sparse_list)
213fi
214
215
216dnl Are we including deprecated features in the install-----------
217AC_MSG_CHECKING([--with-deprecated])
218AC_ARG_WITH(deprecated,
219        AC_HELP_STRING(
220                [--with-deprecated],
221                [include an implicit AD<Base> constructor from any type]
222        ),
223        [deprecated="yes"],
224        [deprecated="no"]
225)
226AC_MSG_RESULT([$deprecated])
227AM_CONDITIONAL(CppAD_DEPRECATED, test "$deprecated" = 'yes' )
228if test "$deprecated" = "yes" ; then
229        AC_SUBST(cppad_deprecated, "1")
230else
231        AC_SUBST(cppad_deprecated, "0")
232fi
233
234dnl The postfix directiory corresponding to CppAD ------------------------
235AC_MSG_CHECKING([POSTFIX_DIR])
236AC_ARG_VAR(POSTFIX_DIR,
237        [postfix directory for CppAD installation]
238)
239AM_CONDITIONAL(CppAD_POSTFIX, test "$POSTFIX_DIR" != "")
240if test "$POSTFIX_DIR" != "" ; then
241        AC_MSG_RESULT([$POSTFIX_DIR])
242else
243        AC_MSG_RESULT([no])
244fi
245
246dnl The prefix corresponding to the installation of Adolc ---------------
247AC_MSG_CHECKING([ADOLC_DIR])
248AC_ARG_VAR(ADOLC_DIR,
249        [value of configure prefix directory during Adolc install]
250)
251AM_CONDITIONAL(CppAD_ADOLC, test "$ADOLC_DIR" != "")
252if test "$ADOLC_DIR" != "" ; then
253        AC_MSG_RESULT([$ADOLC_DIR])
254        if test "$have_ar" = "no"; then
255                AC_MSG_ERROR([ar is missing and ADOLC_DIR is present])
256        fi
257else
258        AC_MSG_RESULT([no])
259fi
260
261dnl The prefix corresponding to the installation of Eigen ---------------
262AC_MSG_CHECKING([EIGEN_DIR])
263AC_ARG_VAR(EIGEN_DIR,
264        [value of configure prefix directory during Eigen install]
265)
266AM_CONDITIONAL(CppAD_EIGEN_DIR, test "$EIGEN_DIR" != "")
267if test "$EIGEN_DIR" != "" ; then
268        AC_MSG_RESULT([$EIGEN_DIR])
269        AC_SUBST(EIGEN_INCLUDE, [-I$EIGEN_DIR/include])
270else
271        AC_MSG_RESULT([no])
272        AC_SUBST(EIGEN_INCLUDE, [])
273fi
274
275dnl The directory corresponding to the installation of FADBAD -----------
276AC_MSG_CHECKING([FADBAD_DIR])
277AC_ARG_VAR(FADBAD_DIR,
278        [parent directory directly above FADBAD++ directory]
279)
280AM_CONDITIONAL(CppAD_FADBAD, test "$FADBAD_DIR" != "")
281if test "$FADBAD_DIR" != "" ; then
282        AC_MSG_RESULT([$FADBAD_DIR])
283        if test "$have_ar" = "no"; then
284                AC_MSG_ERROR([ar is missing and FADBAD_DIR is present])
285        fi
286else
287        AC_MSG_RESULT([no])
288fi
289
290dnl The directory corresponding to the installation of SACADO -----------
291AC_MSG_CHECKING([SACADO_DIR])
292AC_ARG_VAR(SACADO_DIR,
293        [value of the configure prefix directory during Sacado install]
294)
295AM_CONDITIONAL(CppAD_SACADO, test "$SACADO_DIR" != "")
296if test "$SACADO_DIR" != "" ; then
297        AC_MSG_RESULT([$SACADO_DIR])
298        if test "$have_ar" = "no"; then
299                AC_MSG_ERROR([ar is missing and SACADO_DIR is present])
300        fi
301else
302        AC_MSG_RESULT([no])
303fi
304
305dnl The directory corresponding to the installation of IPOPT -----------
306AC_MSG_CHECKING([IPOPT_DIR])
307AC_ARG_VAR(IPOPT_DIR,
308        [value of the configure prefix directory during Ipopt install]
309)
310AM_CONDITIONAL(CppAD_IPOPT, test "$IPOPT_DIR" != "")
311if test "$IPOPT_DIR" != "" ; then
312        AC_MSG_RESULT([$IPOPT_DIR])
313        if test "$have_ar" = "no"; then
314                AC_MSG_ERROR([ar is missing and IPOPT_DIR is present])
315        fi
316else
317        AC_MSG_RESULT([no])
318fi
319
320dnl The directory corresponding to the installation of BOOST ------------
321AC_MSG_CHECKING([BOOST_DIR])
322AC_ARG_VAR(BOOST_DIR,
323        [parent directory directly above boost directory]
324)
325AM_CONDITIONAL(CppAD_BOOST_DIR, test "$BOOST_DIR" != "")
326if test "$BOOST_DIR" != "" ; then
327        AC_MSG_RESULT([$BOOST_DIR])
328        AC_SUBST(BOOST_INCLUDE, [-I$BOOST_DIR/include])
329else
330        AC_MSG_RESULT([no])
331        AC_SUBST(BOOST_INCLUDE,[])
332fi
333
334dnl The C++ compiler flags CXX_FLAGS -------------------------------------
335dnl see AC_SUBST(CXXFLAGS, "") next to AC_PROG_CXX
336#
337AC_MSG_CHECKING([CXX_FLAGS])
338AC_ARG_VAR(CXX_FLAGS,
339        [ CXXFLAGS is ignored, use CXX_FLAGS for compiler flags]
340)
341# cxx_flags for fadbad and eigen
342if test "$CXX_FLAGS" != "" ; then
343        AC_MSG_RESULT([$CXX_FLAGS])
344        cxx_flags_fadbad=`echo "$CXX_FLAGS" | sed -e 's|-Wshadow||'`
345        cxx_flags_eigen="$cxx_flags_fadbda -Wno-long-long"
346else
347        AC_MSG_RESULT([no])
348        cxx_flags_fadbad=""
349        cxx_flags_eigen=""
350fi
351AC_SUBST(CXX_FLAGS_FADBAD, "$cxx_flags_fadbad")
352AC_SUBST(CXX_FLAGS_EIGEN,  "$cxx_flags_eigen")
353
354dnl The compiler OpenMP flags OPENMP_FLAGS ----------------------------------
355AC_MSG_CHECKING([OPENMP_FLAGS])
356AC_ARG_VAR(OPENMP_FLAGS,
357        [ flags that instruct compiler to interpret OpenMP directrives ]
358)
359if test "$OPENMP_FLAGS" != "" ; then
360        AC_MSG_RESULT([$OPENMP_FLAGS])
361else
362        AC_MSG_RESULT([no])
363fi
364AM_CONDITIONAL(CppAD_OPENMP, test "$OPENMP_FLAGS" != "")
365
366dnl The compiler OpenMP flags MAX_NUM_THREADS -------------------------------
367AC_MSG_CHECKING([MAX_NUM_THREADS])
368AC_ARG_VAR(MAX_NUM_THREADS,
369        [ maximum number of threads that can be used with CppAD ]
370)
371if test "$MAX_NUM_THREADS" != "" ; then
372        AC_MSG_RESULT([$MAX_NUM_THREADS])
373        if test "$MAX_NUM_THREADS" -lt "4" ; then
374                AC_MSG_ERROR(
375                        [ MAX_NUM_THREADS=$MAX_NUM_THREADS is less than 4 ]
376                )
377        fi
378        max_num_threads="$MAX_NUM_THREADS"
379else
380        max_num_threads="48"
381        AC_MSG_RESULT([no, using default value $max_num_threads])
382fi
383AC_SUBST(cppad_max_num_threads, [$max_num_threads])
384
385dnl type used for addresses in AD tapes [ default = unsigned int ] -----------
386AC_MSG_CHECKING([TAPE_ADDR_TYPE])
387AC_ARG_VAR(TAPE_ADDR_TYPE, [type used for addresses in AD tapes])
388if test "$TAPE_ADDR_TYPE" == "" ; then
389        addr_t="unsigned int"
390else
391        addr_t="$TAPE_ADDR_TYPE"
392fi
393AC_SUBST(cppad_tape_addr_type, [$addr_t])
394AC_MSG_RESULT([$addr_t])
395ok="no"
396if test "$addr_t" == "size_t" ; then
397        ok="yes"
398fi
399if test "$addr_t" == "int" ; then
400        AC_MSG_WARN(
401                [TAPE_ADDR_TYPE=int is for CppAD developers (not users)]
402        )
403        ok="yes"
404fi
405if test "$addr_t" == "unsigned int" ; then
406        ok="yes"
407fi
408if test "$addr_t" == "unsigned short int" ; then
409        ok="yes"
410fi
411if test "$ok" == "no" ; then
412        AC_MSG_ERROR(
413                [$addr_t is not a valid choice for TAPE_ADDR_TYPE]
414        )
415fi
416
417dnl type used for tape identifier [ default = unsigned int ] -----------
418AC_MSG_CHECKING([TAPE_ID_TYPE])
419AC_ARG_VAR(TAPE_ID_TYPE, [type used for addresses in AD tapes])
420if test "$TAPE_ID_TYPE" == "" ; then
421        tape_id_t="unsigned int"
422else
423        tape_id_t="$TAPE_ID_TYPE"
424fi
425AC_SUBST(cppad_tape_id_type, [$tape_id_t])
426AC_MSG_RESULT([$tape_id_t])
427ok="no"
428if test "$tape_id_t" == "size_t" ; then
429        ok="yes"
430fi
431if test "$tape_id_t" == "int" ; then
432        AC_MSG_WARN(
433                [TAPE_ID_TYPE=int is for CppAD developers (not users)]
434        )
435        ok="yes"
436fi
437if test "$tape_id_t" == "unsigned int" ; then
438        ok="yes"
439fi
440if test "$tape_id_t" == "unsigned short int" ; then
441        ok="yes"
442fi
443if test "$ok" == "no" ; then
444        AC_MSG_ERROR(
445                [$tape_id_t is not a valid choice for TAPE_ID_TYPE]
446        )
447fi
448AC_MSG_NOTICE([********** End Checking Command Line arguments ***************])
449
450dnl --------------------------------------------------------------------------
451if test "$enable_msvc" == "no"
452then
453        cxx_list="g++ clang++ CC pgCC icpc gpp cxx cc++"
454        cc_list="gcc clang cc pgcc icc"
455        fc_list="gfortran ifort g95 fort77 f77 g77 pgf90 pgf77 ifc frt af77"
456else
457        dnl This case defined and supported by Ted Ralphs
458        cxx_list="icl cl g++"
459        cc_list="icl cl gcc"
460        fc_list="ifort gfortran"
461fi
462dnl --------------------------------------------------------------------------
463
464dnl AC_PROG_CXX([compiler-search-list]) outputs CXX as C++ compiler to use
465AC_PROG_CXX([$cxx_list])
466dnl erase any setting of CXXFLAGS, see CXX_FLAGS documentation
467AC_SUBST(CXXFLAGS, "")
468
469dnl AC_PROG_CC([compiler-search-list]) outputs CC as C++ compiler to use
470AC_PROG_CC([$cc_list])
471dnl erase any setting of CFLAGS
472AC_SUBST(CFLAGS, "")
473
474dnl AC_PROG_FC ([compiler-search-list], [dialect])
475AC_PROG_FC([$fc_list])
476dnl not compiling any fortran so no need to touch flags
477
478dnl Check for pkgconfig
479AC_CHECK_PROG(have_pkg_config, [pkg-config], [yes], [no])
480AM_CONDITIONAL(CppAD_PKG_CONFIG, test "$have_pkg_config" = "yes")
481
482dnl check if we can build libraries
483AM_CONDITIONAL(CppAD_HAVE_AR, test "$have_ar" = 'yes' )
484if test "$have_ar" = 'no'; then
485        AC_MSG_WARN(
486        [cannot build any libraries because ar is missing; e.g,, speed/* not built]
487        )
488fi
489
490dnl test_one.sh.in settings for cppad_cxx_flags
491AC_SUBST(cppad_cxx_flags, "-g -O0")
492
493dnl auto-tools version does not colpack
494AC_SUBST(cppad_has_colpack, 0)
495
496dnl auto-tools version will assumes mkstemp is available.
497AC_SUBST(cppad_has_mkstemp, 1)
498
499dnl auto-tools version cannot use c++11 compiler
500dnl so supress corresponding features
501AC_SUBST(cppad_has_nullptr, 0)
502AC_SUBST(cppad_has_rvalue, 0)
503AC_SUBST(cppad_has_cstdint_8_to_64, 0)
504AC_SUBST(cppad_use_cplusplus_2011, 0)
505AC_SUBST(cppad_has_high_resolution_clock, 0)
506
507dnl Determine if size_t has same size as unsigned int
508AC_CHECK_SIZEOF([size_t])
509AC_CHECK_SIZEOF([unsigned int])
510if test "$ac_cv_sizeof_size_t" != "$ac_cv_sizeof_unsigned_int" ; then
511        AC_SUBST(cppad_size_t_not_unsigned_int, 1)
512else
513        AC_SUBST(cppad_size_t_not_unsigned_int, 0)
514fi
515
516dnl Determine which definition we are using for CPPAD_TESTVECTOR
517if test "$stdvector$boostvector$eigenvector" = "nonono" ; then
518        AC_SUBST(cppad_cppadvector, 1)
519else
520        AC_SUBST(cppad_cppadvector, 0)
521fi
522
523dnl the gettimeofday check automatically generates a yes / no configure msg
524AC_CHECK_FUNC(
525        gettimeofday,
526        [gettimeofday="yes"],
527        [gettimeofday="no"]
528)
529if test "$gettimeofday" = "yes" ; then
530        AC_SUBST(cppad_has_gettimeofday, 1)
531else
532        AC_SUBST(cppad_has_gettimeofday, 0)
533fi
534
535dnl Use LIBTOOL for cppad_ipopt ?
536dnl AC_PROG_LIBTOOL
537
538dnl Determine if ranlib is present and where it is if present (set RANLIB)
539AC_PROG_RANLIB
540
541AC_MSG_CHECKING([whether using Microsoft C++ compiler])
542AM_CONDITIONAL(CppAD_MS_COMPILER, test "$CXX" == "cl" || test "$CXX" == "icl")
543if test "$CXX" == "cl" || test "$CXX" == "icl"; then
544        AC_MSG_RESULT([yes])
545else
546        AC_MSG_RESULT([no])
547fi
548
549
550
551dnl Have configure check source directory to see if cppad/cppad.hpp is there
552AC_CONFIG_SRCDIR(cppad/cppad.hpp)
553
554dnl AC_PROG_CP outputs CPP as command to run C preprocessor
555AC_PROG_CPP
556
557dnl Do nothing if complier supports inline, otherwise try to find a subsitute
558dnl definition or, if cannot, define inline as empty
559AC_C_INLINE
560
561dnl determine FCLIBS, flags necessary for linking C++ with modern fortran
562AC_FC_LIBRARY_LDFLAGS
563
564dnl absolute path corresponding to top_builddig and top_srcdir in makefile.am
565dnl (used by cppad-uninstalled.pc.in).
566abs_top_builddir=`pwd`
567AC_SUBST(ABS_TOP_BUILDDIR, "$abs_top_builddir")
568abs_top_srcdir=`cd $srcdir ; pwd`
569AC_SUBST(ABS_TOP_SRCDIR, "$abs_top_srcdir")
570dnl --------------------------------------------------------------------------
571dnl Check for C libraries
572
573dnl check for pthread library
574AC_CHECK_LIB(
575        [pthread],
576        [pthread_barrier_wait],
577        [pthread="yes"],
578        [pthread="no"]
579)
580AM_CONDITIONAL(CppAD_PTHREAD, test "$pthread" = "yes")
581if test "$pthread" == "yes" ; then
582        AC_SUBST(PTHREAD_LIB,"-lpthread")
583else
584        AC_SUBST(PTHREAD_LIB,"")
585fi
586
587dnl check for dl library
588AC_SUBST(DL_LIB, "")
589AC_CHECK_LIB(
590        [dl],
591        [dlopen],
592        [DL_LIB="-ldl"],
593        [DL_LIB=""]
594)
595dnl --------------------------------------------------------------------------
596dnl check for boost thread library
597AC_LANG_PUSH([C++])
598LDFLAGS_save=$LDFLAGS
599CXXFLAGS_save=$CXXFLAGS
600boost_thread_found='no'
601if test "$BOOST_DIR" != '' ; then
602        CXXFLAGS="-I$BOOST_DIR/include $CXXFLAGS"
603fi
604if test "$BOOST_DIR" == '' && test "$boost_thread_found" == 'no' ; then
605        bthread_lib='-lboost_thread-mt'
606        LDFLAGS="$LDFLAGS_save $bthread_lib"
607        AC_LINK_IFELSE(
608                [AC_LANG_PROGRAM(
609                        [# include <boost/thread.hpp>],
610                        [boost::barrier wait(1);]
611                )],
612                [boost_thread_found='yes'],
613                [boost_thread_found='no']
614        )
615fi
616if test "$BOOST_DIR" != '' && test "$boost_thread_found" == 'no' ; then
617        bthread_lib="$BOOST_DIR/lib/libboost_thread-mt.so"
618        LDFLAGS="$LDFLAGS_save $bthread_lib"
619        AC_LINK_IFELSE(
620                [AC_LANG_PROGRAM(
621                        [# include <boost/thread.hpp>],
622                        [boost::barrier wait(1);]
623                )],
624                [boost_thread_found='yes'],
625                [boost_thread_found='no']
626        )
627fi
628if test "$BOOST_DIR" != '' && test "$boost_thread_found" == 'no' ; then
629        bthread_lib="$BOOST_DIR/lib/libboost_thread-mt.a"
630        LDFLAGS="$LDFLAGS_save $bthread_lib"
631        AC_LINK_IFELSE(
632                [AC_LANG_PROGRAM(
633                        [# include <boost/thread.hpp>],
634                        [boost::barrier wait(1);]
635                )],
636                [boost_thread_found='yes'],
637                [boost_thread_found='no']
638        )
639fi
640if test "$BOOST_DIR" == '' && test "$boost_thread_found" == 'no' ; then
641        bthread_lib='-lboost_thread'
642        LDFLAGS="$LDFLAGS_save $bthread_lib"
643        AC_LINK_IFELSE(
644                [AC_LANG_PROGRAM(
645                        [# include <boost/thread.hpp>],
646                        [boost::barrier wait(1);]
647                )],
648                [boost_thread_found='yes'],
649                [boost_thread_found='no']
650        )
651fi
652if test "$BOOST_DIR" != '' && test "$boost_thread_found" == 'no' ; then
653        bthread_lib="$BOOST_DIR/lib/libboost_thread.so"
654        LDFLAGS="$LDFLAGS_save $bthread_lib"
655        AC_LINK_IFELSE(
656                [AC_LANG_PROGRAM(
657                        [# include <boost/thread.hpp>],
658                        [boost::barrier wait(1);]
659                )],
660                [boost_thread_found='yes'],
661                [boost_thread_found='no']
662        )
663fi
664if test "$BOOST_DIR" != '' && test "$boost_thread_found" == 'no' ; then
665        bthread_lib="$BOOST_DIR/lib/libboost_thread.a"
666        LDFLAGS="$LDFLAGS_save $bthread_lib"
667        AC_LINK_IFELSE(
668                [AC_LANG_PROGRAM(
669                        [# include <boost/thread.hpp>],
670                        [boost::barrier wait(1);]
671                )],
672                [boost_thread_found='yes'],
673                [boost_thread_found='no']
674        )
675fi
676AM_CONDITIONAL(CppAD_BTHREAD, test "$boost_thread_found" = 'yes')
677if test "$boost_thread_found" == 'yes' ; then
678        AC_SUBST(BTHREAD_LIB,"$bthread_lib")
679        AC_MSG_RESULT([boost::thread library... yes])
680else
681        AC_SUBST(BTHREAD_LIB,'')
682        AC_MSG_RESULT([boost::thread library... no])
683fi
684LDFLAGS=$LDFLAGS_save
685CXXFLAGS=$CXXFLAGS_save
686AC_LANG_POP([C++])
687#
688dnl --------------------------------------------------------------------------
689dnl Library directories
690if test -e $IPOPT_DIR/lib/coin ; then
691        IPOPT_LIBS="-L $IPOPT_DIR/lib/coin -L $IPOPT_DIR/lib/coin/ThirdParty"
692        IPOPT_LD_PATH="$IPOPT_DIR/lib/coin:$IPOPT_DIR/lib/coin/ThirdParty"
693else
694        IPOPT_LIBS="-L $IPOPT_DIR/lib"
695        IPOPT_LD_PATH="$IPOPT_DIR/lib"
696fi
697AC_SUBST(CPPAD_IPOPT_LD_PATH, "$IPOPT_LD_PATH")
698#
699AC_SUBST(CPPAD_IPOPT_LIBS, "$IPOPT_LIBS -lipopt")
700if test "$have_pkg_config" == "yes"; then
701        dnl set CPPAD_IPOPT_LIBS
702        PKG_CONFIG_PATH="$IPOPT_DIR/lib/pkgconfig:$IPOPT_DIR/share/pkgconfig"
703        PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$IPOPT_DIR/lib64/pkgconfig"
704        export PKG_CONFIG_PATH
705        if pkg-config --libs ipopt >& /dev/null ; then
706                CPPAD_IPOPT_LIBS=`pkg-config --libs ipopt`
707        else
708                dnl check for blas library
709                AC_LANG_PUSH([Fortran])
710                AC_CHECK_LIB(
711                        [blas],
712                        [ddot],
713                        [CPPAD_IPOPT_LIBS="$CPPAD_IPOPT_LIBS -lblas"],
714                )
715                dnl check for lapack library
716                AC_CHECK_LIB(
717                        [lapack],
718                        [dgesv],
719                        [CPPAD_IPOPT_LIBS="$CPPAD_IPOPT_LIBS -llapack"],
720                )
721                AC_LANG_POP([Fortran])
722        fi
723else
724        dnl check for blas library
725        AC_LANG_PUSH([Fortran])
726        AC_CHECK_LIB(
727                [blas],
728                [ddot],
729                [CPPAD_IPOPT_LIBS="$CPPAD_IPOPT_LIBS -lblas"],
730        )
731        dnl check for lapack library
732        AC_CHECK_LIB(
733                [lapack],
734                [dgesv],
735                [CPPAD_IPOPT_LIBS="$CPPAD_IPOPT_LIBS -llapack"],
736        )
737        AC_LANG_POP([Fortran])
738fi
739AC_MSG_RESULT([cppad_ipopt_nlp libraries: $CPPAD_IPOPT_LIBS])
740dnl --------------------------------------------------------------------------
741dnl Names set here so same cppad.pc.in works for both with cmake and autoconf.
742dnl (note that autoconf configuration does not allow for Colpack).
743dnl
744AC_SUBST(cppad_description, "Differentiation of C++ Algorithms")
745AC_SUBST(cppad_version, ${PACKAGE_VERSION} )
746AC_SUBST(cppad_url, "http://www.coin-or.org/CppAD")
747if test "$prefix" == "NONE" ; then
748        cppad_pkgconfig_cflags_value="-I$HOME/include"
749        cppad_pkgconfig_libs_value="-L$HOME/lib"
750else
751        cppad_pkgconfig_cflags_value="-I$prefix/include"
752        cppad_pkgconfig_libs_value="-L$prefix/lib"
753fi
754if test "$POSTFIX_DIR" != "" ; then
755        cppad_pkgconfig_cflags_value="$cppad_cflags_value/$POSTFIX_DIR"
756        cppad_pkgconfig_libs_value="$cppad_pkgconfig_libs_value/$POSTFIX_DIR"
757fi
758if test "$IPOPT_DIR" == "" ; then
759        cppad_pkgconfig_libs_value=""
760        cppad_pkgconfig_requires_value=""
761else
762        cppad_pkgconfig_libs_value="$cppad_pkgconfig_libs_value -lcppad_ipopt"
763        cppad_pkgconfig_requires_value="ipopt"
764fi
765AC_SUBST(cppad_pkgconfig_cflags,   "$cppad_pkgconfig_cflags_value")
766AC_SUBST(cppad_pkgconfig_libs,     "$cppad_pkgconfig_libs_value")
767AC_SUBST(cppad_pkgconfig_requires, "$cppad_pkgconfig_requires_value")
768dnl
769dnl names set here so cppad.pc-uninstalled works both with cmake and autoconf
770AC_SUBST(cppad_SOURCE_DIR,  ${ABS_TOP_SRCDIR} )
771dnl
772dnl names set here so */test_one.sh.in works both with cmake and autoconf
773AC_SUBST(adolc_prefix,      ${ADOLC_DIR} )
774AC_SUBST(eigen_prefix,      ${EIGEN_DIR} )
775AC_SUBST(ipopt_prefix,      ${IPOPT_DIR} )
776dnl
777dnl -----------------------------------------------------------------------
778dnl AC_CONFIG_FILES(file-list) for each file in the list, configure will
779dnl read file.in, do its substitutions, and create file
780AC_CONFIG_FILES([
781        cppad/configure.hpp
782        cppad_ipopt/example/test.sh
783        cppad_ipopt/speed/test.sh
784        cppad_ipopt/test/test.sh
785        example/ipopt_solve/test.sh
786        example/test_one.sh
787        pkgconfig/cppad.pc
788        pkgconfig/cppad-uninstalled.pc
789        test_more/test_one.sh
790
791        makefile
792        compare_c/makefile
793        cppad_ipopt/src/makefile
794        cppad_ipopt/example/makefile
795        cppad_ipopt/speed/makefile
796        cppad_ipopt/test/makefile
797        example/makefile
798        example/atomic/makefile
799        example/ipopt_solve/makefile
800        introduction/get_started/makefile
801        introduction/exp_apx/makefile
802        multi_thread/makefile
803        multi_thread/test_multi/makefile
804        print_for/makefile
805        speed/adolc/makefile
806        speed/cppad/makefile
807        speed/double/makefile
808        speed/example/makefile
809        speed/fadbad/makefile
810        speed/profile/makefile
811        speed/profile/gprof.sed
812        speed/sacado/makefile
813        speed/src/makefile
814        test_more/makefile
815])
816dnl END AC_CONFIG_FILES
817dnl the comment line above is used by ./new_stable.sh
818
819AC_CONFIG_COMMANDS(
820        [example_ipopt_solve_test.sh],
821        [chmod +x example/ipopt_solve/test.sh],
822)       []
823AC_CONFIG_COMMANDS(
824        [cppad_ipopt_example_test.sh],
825        [chmod +x cppad_ipopt/example/test.sh],
826)       []
827AC_CONFIG_COMMANDS(
828        [cppad_ipopt_speed_test.sh],
829        [chmod +x cppad_ipopt/speed/test.sh],
830        []
831)
832AC_CONFIG_COMMANDS(
833        [cppad_ipopt_test_test.sh],
834        [chmod +x cppad_ipopt/test/test.sh],
835        []
836)
837AC_CONFIG_COMMANDS(
838        [example_test_one.sh],
839        [chmod +x example/test_one.sh],
840        []
841)
842AC_CONFIG_COMMANDS(
843        [test_more_test_one.sh],
844        [chmod +x test_more/test_one.sh],
845        []
846)
847
848dnl create all the requested output files
849AC_OUTPUT
Note: See TracBrowser for help on using the repository browser.