1 | # -*- Autoconf -*- |
---|
2 | # Process this file with autoconf to produce a configure script. |
---|
3 | |
---|
4 | AC_PREREQ([2.68]) |
---|
5 | AC_INIT([cfa-cc],[1.0.0.0],[cforall@plg.uwaterloo.ca]) |
---|
6 | AC_CONFIG_AUX_DIR([automake]) |
---|
7 | #AC_CONFIG_SRCDIR([src/main.cc]) |
---|
8 | AC_CONFIG_HEADERS([config.h]) |
---|
9 | AM_SILENT_RULES([no]) |
---|
10 | |
---|
11 | if test "x${CXXFLAGS}" = "x"; then |
---|
12 | export CXXFLAGS="-std=c++11 -g ${CXXFLAGS}" # defaults, no -O2 for debugging and failures |
---|
13 | else |
---|
14 | export CXXFLAGS="-std=c++11 ${CXXFLAGS}" # flags from configure command |
---|
15 | fi |
---|
16 | |
---|
17 | AM_INIT_AUTOMAKE |
---|
18 | AM_MAINTAINER_MODE(enable) # may require auto* software to be installed |
---|
19 | |
---|
20 | rm -f version |
---|
21 | echo ${PACKAGE_VERSION} > version # file containing version number for other tools |
---|
22 | chmod ugo-w version |
---|
23 | ver_major=`cut -d '.' -f1 version` # subdivide version number into components at periods |
---|
24 | ver_minor=`cut -d '.' -f2 version` |
---|
25 | ver_patch=`cut -d '.' -f3 version` |
---|
26 | ver_build=`cut -d '.' -f4 version` |
---|
27 | |
---|
28 | # AC_SUBST([CONFIG_STATUS_DEPENDENCIES], ['$(top_srcdir)/version']) |
---|
29 | AC_DEFINE_UNQUOTED(CFA_VERSION_MAJOR, ${ver_major}, [Major version number.]) |
---|
30 | AC_DEFINE_UNQUOTED(CFA_VERSION_MINOR, ${ver_minor}, [Minor version number.]) |
---|
31 | AC_DEFINE_UNQUOTED(CFA_VERSION_PATCH, ${ver_patch}, [Patch version number.]) |
---|
32 | AC_DEFINE_UNQUOTED(CFA_VERSION_BUILD, ${ver_build}, [Build version number.]) |
---|
33 | AC_DEFINE_UNQUOTED(CFA_VERSION_SHORT, ["${ver_major}"], [Major]) |
---|
34 | AC_DEFINE_UNQUOTED(CFA_VERSION, ["${ver_major}.${ver_minor}"], [Major.Minor]) |
---|
35 | AC_DEFINE_UNQUOTED(CFA_VERSION_LONG, ["${ver_major}.${ver_minor}.${ver_patch}"], [Major.Minor.Patch]) |
---|
36 | AC_DEFINE_UNQUOTED(CFA_VERSION_FULL, ["${ver_major}.${ver_minor}.${ver_patch}.${ver_build}"], [Major.Minor.Patch.Build]) |
---|
37 | |
---|
38 | # Installation paths |
---|
39 | |
---|
40 | AC_ARG_WITH(backend-compiler, |
---|
41 | [ --with-backend-compiler=PROGRAM PROGRAM that performs the final code compilation (must be gcc-compatible) ], |
---|
42 | backendcompiler=$withval, backendcompiler="") |
---|
43 | if test "x$backendcompiler" != "x"; then |
---|
44 | BACKEND_CC=${backendcompiler} |
---|
45 | else |
---|
46 | AC_PATH_PROG(BACKEND_CC, gcc, []) # check gcc installed |
---|
47 | if test "x$BACKEND_CC" = "x"; then |
---|
48 | AC_MSG_ERROR(some version of gcc is needed. Get it at ftp://ftp.gnu.org) |
---|
49 | exit 1 |
---|
50 | fi |
---|
51 | fi |
---|
52 | AC_DEFINE_UNQUOTED(CFA_BACKEND_CC, "${BACKEND_CC}", [Location of include files.]) |
---|
53 | AC_SUBST(CFA_BACKEND_CC) |
---|
54 | |
---|
55 | if test "x$prefix" = "xNONE"; then |
---|
56 | cfa_prefix=${ac_default_prefix} |
---|
57 | else |
---|
58 | cfa_prefix=${prefix} |
---|
59 | fi |
---|
60 | AC_DEFINE_UNQUOTED(CFA_PREFIX, "${cfa_prefix}", [Location of cfa install.]) |
---|
61 | AC_SUBST(CFA_PREFIX, ${cfa_prefix}) |
---|
62 | |
---|
63 | if test "$includedir" = '${prefix}/include'; then |
---|
64 | cfa_incdir="${cfa_prefix}/include" |
---|
65 | else |
---|
66 | cfa_incdir=${includedir} |
---|
67 | fi |
---|
68 | AC_DEFINE_UNQUOTED(CFA_INCDIR, "${cfa_incdir}", [Location of include files.]) |
---|
69 | AC_SUBST(CFA_INCDIR, ${cfa_incdir}) |
---|
70 | |
---|
71 | if test "$bindir" = '${exec_prefix}/bin'; then |
---|
72 | cfa_bindir="${cfa_prefix}/bin" |
---|
73 | else |
---|
74 | cfa_bindir=${bindir} |
---|
75 | fi |
---|
76 | AC_DEFINE_UNQUOTED(CFA_BINDIR, "${cfa_bindir}", [Location of cfa command.]) |
---|
77 | AC_SUBST(CFA_BINDIR, ${cfa_bindir}) |
---|
78 | |
---|
79 | if test "$libdir" = '${exec_prefix}/lib'; then |
---|
80 | cfa_libdir=${cfa_prefix}/lib |
---|
81 | else |
---|
82 | cfa_libdir=${libdir} |
---|
83 | fi |
---|
84 | AC_DEFINE_UNQUOTED(CFA_LIBDIR, "${cfa_libdir}", [Location of cc1 and cfa-cpp commands.]) |
---|
85 | AC_SUBST(CFA_LIBDIR, ${cfa_libdir}) |
---|
86 | |
---|
87 | AC_DEFINE_UNQUOTED(CFA_FLAGS, "${CFAFLAGS}", [compilation flags for cfa libraries and test programs.]) |
---|
88 | AC_SUBST(CFA_FLAGS, ${CFAFLAGS}) |
---|
89 | |
---|
90 | AC_CANONICAL_HOST |
---|
91 | AC_SUBST([MACHINE_TYPE],[$host_cpu]) |
---|
92 | |
---|
93 | # Checks for programs. |
---|
94 | AC_PROG_CXX |
---|
95 | AC_PROG_CC |
---|
96 | AM_PROG_AS |
---|
97 | AM_PROG_CC_C_O # deprecated |
---|
98 | # These are often not installed and people miss seeing the "no", so stop the configure. |
---|
99 | AC_PROG_YACC |
---|
100 | if test "${YACC}" = "yacc" ; then echo "Error: bison required." ; exit 1 ; fi |
---|
101 | AC_PROG_LEX |
---|
102 | if test "${LEX}" = "lex" ; then echo "Error: flex required." ; exit 1 ; fi |
---|
103 | AC_PROG_INSTALL |
---|
104 | AC_PROG_MAKE_SET |
---|
105 | AC_PROG_RANLIB |
---|
106 | |
---|
107 | # Checks for libraries. |
---|
108 | |
---|
109 | # Checks for header files. |
---|
110 | AC_FUNC_ALLOCA |
---|
111 | AC_CHECK_HEADERS([fenv.h float.h inttypes.h libintl.h limits.h malloc.h stddef.h stdlib.h string.h unistd.h]) |
---|
112 | |
---|
113 | # Checks for typedefs, structures, and compiler characteristics. |
---|
114 | AC_HEADER_STDBOOL |
---|
115 | AC_C_INLINE |
---|
116 | AC_TYPE_INT16_T |
---|
117 | AC_TYPE_INT32_T |
---|
118 | AC_TYPE_INT8_T |
---|
119 | AC_C_RESTRICT |
---|
120 | AC_TYPE_SIZE_T |
---|
121 | AC_TYPE_UINT16_T |
---|
122 | AC_TYPE_UINT32_T |
---|
123 | AC_TYPE_UINT8_T |
---|
124 | |
---|
125 | # Checks for library functions. |
---|
126 | AC_CHECK_FUNCS([memset putenv strchr strtol]) |
---|
127 | |
---|
128 | AC_CONFIG_FILES([ |
---|
129 | Makefile |
---|
130 | src/driver/Makefile |
---|
131 | src/Makefile |
---|
132 | src/examples/Makefile |
---|
133 | src/tests/Makefile |
---|
134 | src/libcfa/Makefile |
---|
135 | ]) |
---|
136 | |
---|
137 | AC_OUTPUT |
---|
138 | |
---|
139 | # Final text |
---|
140 | AC_MSG_RESULT(Cforall configuraton completed. Type "make -j 8 install".) |
---|