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
7 AM_CONFIG_HEADER(config.h)
9 AC_SUBST(SHARED_VERSION_INFO)
10 AC_DISABLE_SHARED dnl to hell with shared libraries
12 dnl Checks for programs.
22 dnl Checks for typedefs, structures, and compiler characteristics.
25 AC_CHECK_HEADERS([unistd.h getopt.h stdint.h])
29 dnl find 32-bit unsigned integer type for random-number generator
30 AC_CHECK_SIZEOF(unsigned int)
31 AC_CHECK_SIZEOF(unsigned long)
32 AC_CHECK_TYPES(uint32_t, [], [], [$ac_includes_default
37 dnl Checks for libraries and functions
39 AC_CHECK_FUNCS([BSDgettimeofday gettimeofday time])
41 AC_MSG_CHECKING([for isnan])
42 AC_TRY_LINK([#include <math.h>
43 ], if (!isnan(3.14159)) isnan(2.7183);, ok=yes, ok=no)
44 if test "$ok" = "yes"; then
45 AC_DEFINE(HAVE_ISNAN,1,[Define if the isnan() function/macro is available.])
49 AC_MSG_CHECKING([for isinf])
50 AC_TRY_LINK([#include <math.h>
51 ], if (!isinf(3.14159)) isinf(2.7183);, ok=yes, ok=no)
52 if test "$ok" = "yes"; then
53 AC_DEFINE(HAVE_ISINF,1,[Define if the isinf() function/macro is available.])
57 dnl -----------------------------------------------------------------------
58 dnl Compiling Octave plug-in
60 AC_ARG_VAR(OCT_INSTALL_DIR, [where to install GNU Octave .oct plug-ins])
61 AC_ARG_VAR(M_INSTALL_DIR, [where to install GNU Octave .m plug-ins])
62 AC_ARG_VAR(MKOCTFILE, [name of mkoctfile program to compile Octave plug-ins])
64 AC_CHECK_PROGS(MKOCTFILE, mkoctfile, echo)
65 if test "$MKOCTFILE" = "echo"; then
66 AC_MSG_WARN([can't find mkoctfile: won't be able to compile GNU Octave plugin])
67 elif test x"$OCT_INSTALL_DIR" = "x"; then
68 # try to find installation directory
69 AC_CHECK_PROGS(OCTAVE, octave, echo)
70 AC_MSG_CHECKING(for Octave loadpath)
71 OCTAVE_LOADPATH=`echo "DEFAULT_LOADPATH" | $OCTAVE -q | cut -d'=' -f2`
72 AC_MSG_RESULT($OCTAVE_LOADPATH)
73 AC_MSG_CHECKING(where Octave plugins go)
74 OCT_INSTALL_DIR=`echo "$OCTAVE_LOADPATH" | tr ':' '\n' | grep "site/oct" | head -1`
75 if test -n "$OCT_INSTALL_DIR"; then
76 AC_MSG_RESULT($OCT_INSTALL_DIR)
78 AC_MSG_RESULT(unknown)
79 AC_MSG_WARN([can't find where to install GNU Octave plugins])
81 AC_MSG_CHECKING(where Octave scripts go)
82 M_INSTALL_DIR=`echo "$OCTAVE_LOADPATH" | tr ':' '\n' | grep "site/m" | head -1`
83 if test -n "$M_INSTALL_DIR"; then
84 AC_MSG_RESULT($M_INSTALL_DIR)
86 AC_MSG_RESULT(unknown)
87 AC_MSG_WARN([can't find where to install GNU Octave scripts])
90 AM_CONDITIONAL(WITH_OCTAVE, test x"$OCT_INSTALL_DIR" != "x")
91 AC_SUBST(OCT_INSTALL_DIR)
92 AC_SUBST(M_INSTALL_DIR)
95 dnl -----------------------------------------------------------------------
98 AC_ARG_ENABLE(debug, [AC_HELP_STRING([--enable-debug],[compile with extra runtime checks for debugging])], ok=$enableval, ok=no)
99 if test "$ok" = "yes"; then
100 AC_DEFINE(DEBUG,1,[Define to enable extra debugging code.])
103 dnl override CFLAGS selection when debugging
104 if test "${enable_debug}" = "yes"; then
110 dnl add gcc warnings, in debug/maintainer mode only
111 if test "$enable_debug" = yes || test "$USE_MAINTAINER_MODE" = yes; then
112 if test $ac_cv_prog_gcc = yes; then
113 if test "$ac_test_CFLAGS" != "set"; then
114 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"
116 if test "$ac_test_CXXFLAGS" != "set"; then
117 CXXFLAGS="$CXXFLAGS -Wall -W -Wcast-qual -Wpointer-arith -Wcast-align -pedantic -Wshadow -Wwrite-strings -Wredundant-decls -Wundef -Wconversion"
122 vers=`echo ${VERSION}.0.0 | cut -d. -f1`
123 AC_DEFINE_UNQUOTED(MAJOR_VERSION, $vers, [Major version number.])
124 vers=`echo ${VERSION}.0.0 | cut -d. -f2`
125 AC_DEFINE_UNQUOTED(MINOR_VERSION, $vers, [Minor version number.])
126 vers=`echo ${VERSION}.0.0 | cut -d. -f3`
127 AC_DEFINE_UNQUOTED(BUGFIX_VERSION, $vers, [Bugfix version number.])
129 dnl -----------------------------------------------------------------------