chiark / gitweb /
14580de0c2ba21cdfb1afe62b7a8d5a0e0beffa3
[nlopt.git] / configure.ac
1 dnl Process this file with autoconf to produce a configure script.
2 AC_INIT(nlopt, 0.1, stevenj@alum.mit.edu)
3 AC_CONFIG_SRCDIR(api/nlopt.h)
4 SHARED_VERSION_INFO="0:0:0" # CURRENT:REVISION:AGE
5
6 AM_INIT_AUTOMAKE(1.7)
7 AM_CONFIG_HEADER(config.h)
8 AM_MAINTAINER_MODE
9 AC_SUBST(SHARED_VERSION_INFO)
10 AC_DISABLE_SHARED dnl to hell with shared libraries
11
12 dnl Checks for programs.
13 AC_PROG_CC
14 AC_PROG_CXX
15 AC_PROG_CC_STDC
16 AC_PROG_INSTALL
17 AC_PROG_LN_S
18 AC_PROG_MAKE_SET
19 AC_LIBTOOL_WIN32_DLL
20 AC_PROG_LIBTOOL
21
22 dnl Checks for typedefs, structures, and compiler characteristics.
23 AC_HEADER_STDC
24 AC_HEADER_TIME
25 AC_C_CONST
26 AC_C_INLINE
27
28 dnl Checks for libraries and functions
29 AC_CHECK_LIB(m, sin)
30 AC_CHECK_FUNCS([BSDgettimeofday gettimeofday])
31
32 AC_MSG_CHECKING([for isnan])
33 AC_TRY_LINK([#include <math.h>
34 ], if (!isnan(3.14159)) isnan(2.7183);, ok=yes, ok=no)
35 if test "$ok" = "yes"; then
36         AC_DEFINE(HAVE_ISNAN,1,[Define if the isnan() function/macro is available.])
37 fi
38 AC_MSG_RESULT(${ok})
39
40 AC_MSG_CHECKING([for isinf])
41 AC_TRY_LINK([#include <math.h>
42 ], if (!isinf(3.14159)) isinf(2.7183);, ok=yes, ok=no)
43 if test "$ok" = "yes"; then
44         AC_DEFINE(HAVE_ISINF,1,[Define if the isinf() function/macro is available.])
45 fi
46 AC_MSG_RESULT(${ok})
47
48 dnl -----------------------------------------------------------------------
49 dnl Debugging
50
51 AC_ARG_ENABLE(debug, [AC_HELP_STRING([--enable-debug],[compile with extra runtime checks for debugging])], ok=$enableval, ok=no)
52 if test "$ok" = "yes"; then
53         AC_DEFINE(DEBUG,1,[Define to enable extra debugging code.])
54 fi
55
56 dnl override CFLAGS selection when debugging
57 if test "${enable_debug}" = "yes"; then
58         CFLAGS="-g"
59         CXXFLAGS="-g"
60         FFLAGS="-g"
61 fi
62
63 dnl add gcc warnings, in debug/maintainer mode only
64 if test "$enable_debug" = yes || test "$USE_MAINTAINER_MODE" = yes; then
65 if test $ac_cv_prog_gcc = yes; then
66    if test "$ac_test_CFLAGS" != "set"; then
67       CFLAGS="$CFLAGS -Wall -W -Wcast-qual -Wpointer-arith -Wcast-align -pedantic -Wshadow -Wbad-function-cast -Wwrite-strings -Wstrict-prototypes -Wredundant-decls -Wnested-externs -Wundef -Wconversion -Wmissing-prototypes -Wmissing-declarations"
68    fi
69    if test "$ac_test_CXXFLAGS" != "set"; then
70       CXXFLAGS="$CXXFLAGS -Wall -W -Wcast-qual -Wpointer-arith -Wcast-align -pedantic -Wshadow -Wwrite-strings -Wredundant-decls -Wundef -Wconversion"
71    fi
72 fi
73 fi
74
75 dnl -----------------------------------------------------------------------
76
77 AC_CONFIG_FILES([
78    Makefile
79    nlopt.pc
80    api/Makefile
81    direct/Makefile
82    stogo/Makefile
83    lbfgs/Makefile
84    subplex/Makefile
85 ])
86
87 AC_OUTPUT