source: trunk/configure.ac @ 3071

Last change on this file since 3071 was 3070, checked in by bradbell, 6 years ago

revert back to explicit for ctor from any type as default

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