Fail better when assigning to model$objective
[openmx:proteins-proteins-openmx.git] / configure.ac
1 AC_INIT(OpenMx, 0.1)
2 AC_PREREQ([2.62])
3 AC_CONFIG_AUX_DIR("inst/tools")
4
5 npsol_library='inst/npsol'
6
7 : ${R_HOME:=`R RHOME`}
8 if test -z "${R_HOME}"; then 
9 echo "could not determine R_HOME" 
10 exit 1 
11 fi 
12
13 # check for gcc compiler
14 AC_PROG_CC
15 AS_IF([test "x$enable_openmp" != "xno"], [
16 AC_OPENMP
17 ])
18 AC_MSG_CHECKING(whether gcc is installed)
19 if test "$GCC" != yes; then
20 AC_MSG_RESULT(no)
21 AC_MSG_ERROR(gcc is not the default C compiler)
22 compiler_specific_flags=""
23 else
24 AC_MSG_RESULT(yes)
25 compiler_specific_flags="-Wall"
26 fi
27
28 # check the host type
29 AC_CANONICAL_HOST
30 case "${host_os}" in
31 linux-gnu*) 
32     omx_platform=linux 
33     arch_specific_linker_flags=""
34     arch_specific_compiler_flags=""
35     ;;
36 darwin*) 
37     omx_platform=osx 
38     arch_specific_linker_flags="-mmacosx-version-min=10.4"
39     arch_specific_compiler_flags="-mmacosx-version-min=10.4"
40     ;;
41 *) AC_MSG_ERROR(host os is not recognized: ${host_os}) ;;
42 esac
43
44 case "${omx_platform}" in
45 linux)
46    case "${host_cpu}" in
47    *86) omx_arch=x86 ;;
48    *86_64) omx_arch=x86_64 ;;
49    *) AC_MSG_ERROR(host arch is not recognized: ${host_cpu}) ;;
50    esac
51
52    # check for gcc version number
53    AX_GCC_VERSION
54    AC_PROG_AWK
55    major_release=`echo "$GCC_VERSION" | $AWK -F '.' '{print $1 "." $2}'`
56    npsol_library="${npsol_library}/linux/${omx_arch}/gcc${major_release}"
57 ;;
58 osx)
59    npsol_library="${npsol_library}/osx"
60 ;;
61 *)
62    AC_MSG_ERROR(openmx platform is not recognized: ${omx_platform})
63 esac
64
65 npsol_file="${npsol_library}/libnpsol.a"
66 AC_CHECK_FILE([${npsol_file}],,[AC_MSG_ERROR([npsol library not found])])
67
68 npsol_dir="../${npsol_library}"
69 AC_SUBST(npsol_dir)
70 AC_SUBST(compiler_specific_flags)
71 AC_SUBST(arch_specific_linker_flags)
72 AC_SUBST(arch_specific_compiler_flags)
73 AC_SUBST(OPENMP_CFLAGS)
74 AC_CONFIG_FILES([src/Makevars])
75
76 AC_CONFIG_COMMANDS([src/omxSymbolTable.h],[${R_HOME}/bin/R --slave --vanilla < inst/tools/genSymbolTableHeader.R  > src/omxSymbolTable.h],[R_HOME=${R_HOME}])
77 AC_CONFIG_COMMANDS([src/omxSymbolTable.c],[${R_HOME}/bin/R --slave --vanilla < inst/tools/genSymbolTableSource.R  > src/omxSymbolTable.c],[R_HOME=${R_HOME}])
78 AC_OUTPUT