source: releases/20180000.0/configure.ac @ 3999

Last change on this file since 3999 was 3997, checked in by bradbell, 20 months ago

merge to branch: stable/20180000
from repository: https://github.com/coin-or/CppAD
start hash code: missing
end hash code: 9e35f3c9ea1ca60153f96e6bb7e5658ee75eb4fd

Change version to 2018000.0

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