Import code from my Subversion repository
[black_box_cellml.git] / configure.ac
blob77b7f85795993fd4ebfc1e55f6dee451f1960b9f
1 #                                               -*- Autoconf -*-
2 # Process this file with autoconf to produce a configure script.
4 AM_CXXFLAGS=
6 AC_INIT(BlackBoxCellML, 0.1, [[ak.miller@auckland.ac.nz]])
7 AC_PREREQ(2.59)
8 AC_CONFIG_SRCDIR([sources/BlaBoC/BlaBoCImpl.cpp])
9 AC_CONFIG_AUX_DIR([.])
10 AC_CONFIG_HEADER([blaboc_config.h])
12 AM_INIT_AUTOMAKE([-Wno-portability])
13 PKG_PROG_PKG_CONFIG
15 AC_ARG_WITH(cellml_api,
16 [  --with-cellml_api=/path/to/API  Path to the CellML API],
17 [if test -d ${withval}; then
18     if test ! -f ${withval}/libcellml.la; then
19        AC_MSG_ERROR(The path given in --with-cellml-api=$cellml_api doesn't contain a compiled CellML API)
20     fi
21     CELLML_API_DIR=$withval
22 else
23         AC_MSG_ERROR(The path given in --with-cellml-api=$cellml_api doesn't exist or isn't a directory)
24 fi],[AC_MSG_ERROR(You didn't specify the path to the CellML API)])
26 # Checks for programs.
27 AC_PROG_CXX
28 AC_LANG(C)
29 AC_LANG(C++)
31 # Set up libtool...
32 AC_LIBTOOL_DLOPEN
33 AC_LIBLTDL_CONVENIENCE
34 AC_DISABLE_STATIC
35 AC_LIBTOOL_WIN32_DLL
36 AC_PROG_LIBTOOL
37 AC_LIB_LTDL
38 LT_LANG(C++)
39 AC_SUBST([LIBTOOL_DEPS])
41 # Checks for types...
42 AC_TYPE_INT16_T
43 AC_TYPE_UINT16_T
44 AC_TYPE_INT32_T
45 AC_TYPE_UINT32_T
46 AC_TYPE_UINT64_T
48 # Checks for typedefs, structures, and compiler characteristics.
49 AC_HEADER_STDBOOL
50 AC_C_CONST
51 AC_C_INLINE
53 # Checks for library functions.
54 AC_HEADER_STDC
56 # Check for size of wchar_t...
57 AC_CHECK_SIZEOF(wchar_t*)
59 case $srcdir in
60   [\\/]* | ?:[\\/]* ) # Absolute
61      abssrcdir=$srcdir
62      testdir=$srcdir/tests
63      ;;
64   *)
65      abssrcdir=`pwd`/$srcdir
66      testdir=`pwd`/$srcdir/tests ;;
67 esac
69 case "$build" in
70 *-cygwin*|*-mingw*|*-msvc*|*-mks*|*w32*)
71     testdir=`$srcdir/build/cygwin-wrapper echo $testdir`
72     ;;
73 esac
75 VISIBILITY_FLAGS=
76 EXTRA_OPTIMISATION=
77 dnl Borrowed from glibc configure.in
78 dnl ===============================================================
79 if test "$GCC" = "yes"; then
80   AC_CACHE_CHECK(for visibility(hidden) attribute,
81                  ac_cv_visibility_hidden,
82                  [cat > conftest.c <<EOF
83                   int foo __attribute__ ((visibility ("hidden"))) = 1;
84 EOF
85                   ac_cv_visibility_hidden=no
86                   if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
87                     if grep '\.hidden.*foo' conftest.s >/dev/null; then
88                       ac_cv_visibility_hidden=yes
89                     fi
90                   fi
91                   rm -f conftest.[cs]
92                  ])
93   if test "$ac_cv_visibility_hidden" = "yes"; then
94     AC_DEFINE([HAVE_VISIBILITY_ATTRIBUTE], [], [Define if gcc visibility attributes supported])
95     VISIBILITY_FLAGS=-fvisibility=hidden
96   fi
97   EXTRA_OPTIMISATION="-O2 -ffast-math"
100 AM_CXXFLAGS="$AM_CXXFLAGS $VISIBILITY_FLAGS"
102 CXXFLAGS="$CXXFLAGS $EXTRA_OPTIMISATION"
103 CFLAGS="$CFLAGS $EXTRA_OPTIMISATION"
105 # Host specific peculiarities...
106 CYGWIN_WRAPPER=
107 STLLINK=
109 if test "$with_gnu_ld" = yes; then
110   # Catch unresolved symbols on all platforms, because they will break the
111   # build when we try on Win32.
112   STLLINK="$STLLINK -Wl,--unresolved-symbols=ignore-in-shared-libs"
115 case "$host-$CXX" in
116 *msvc*|*wince*)
117         STLLINK=-no-undefined
118         CYGWIN_WRAPPER="${abssrcdir}/build/cygwin-wrapper"
119         ;;
120 *cygwin*|*mks*|*mingw*)
121         case "$build" in
122         *cygwin*|*mks*|*msvc*|*wince|*mingw*)
123                 STLLINK="-lstlport.5.0 -no-undefined"
124                 CYGWIN_WRAPPER="${abssrcdir}/build/cygwin-wrapper"
125                 ;;
126         *)
127                 STLLINK=-no-undefined
128                 ;;
129         esac
130         ;;
131 *linux*)
132         STLLINK="$STLLINK -lpthread"
133         ;;
135         ;;
136 esac
137 AC_SUBST([CYGWIN_WRAPPER])
138 AC_SUBST([STLLINK])
139 AC_SUBST([AM_CXXFLAGS])
140 AC_SUBST([THREADFLAGS])
141 AC_SUBST([CELLML_API_DIR])
143 AC_DEFINE_UNQUOTED(TESTDIR, L"$testdir",
144                    [Define TESTDIR to path of test sources.])
146 AC_CONFIG_FILES([
147                  Makefile
148                 ])
149 AC_OUTPUT