source: configure.ac @ 5c6afcd

ADTaaron-thesisarm-ehast-experimentalcleanup-dtorsdeferred_resndemanglerenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprnew-envno_listpersistent-indexerpthread-emulationqualifiedEnumresolv-newwith_gc
Last change on this file since 5c6afcd was 9def87a, checked in by Thierry Delisle <tdelisle@…>, 8 years ago

Added macros to select build target in configure

  • Property mode set to 100644
File size: 5.7 KB
RevLine 
[5d6ce1f]1#                                               -*- Autoconf -*-
2# Process this file with autoconf to produce a configure script.
3
4AC_PREREQ([2.68])
[4b1afb6]5AC_INIT([cfa-cc],[1.0.0.0],[cforall@plg.uwaterloo.ca])
[00cc023]6AC_CONFIG_AUX_DIR([automake])
[d3b7937]7#AC_CONFIG_SRCDIR([src/main.cc])
[5d6ce1f]8AC_CONFIG_HEADERS([config.h])
[ef7d253]9AM_SILENT_RULES([no])
[5d6ce1f]10
[90c3b1c]11if test "x${CXXFLAGS}" = "x"; then
[6e4b913]12   export CXXFLAGS="-std=c++11 -g ${CXXFLAGS}"  # defaults, no -O2 for debugging and failures
[90c3b1c]13else
[6e4b913]14   export CXXFLAGS="-std=c++11 ${CXXFLAGS}"     # flags from configure command
[90c3b1c]15fi
16
[00cc023]17AM_INIT_AUTOMAKE
[6e4b913]18AM_MAINTAINER_MODE(enable)                      # may require auto* software to be installed
[00cc023]19
[65c61ec]20rm -f version
[2042d41]21echo ${PACKAGE_VERSION} > version               # file containing version number for other tools
[65c61ec]22chmod ugo-w version
[2042d41]23ver_major=`cut -d '.' -f1 version`              # subdivide version number into components at periods
24ver_minor=`cut -d '.' -f2 version`
25ver_patch=`cut -d '.' -f3 version`
26ver_build=`cut -d '.' -f4 version`
[47a8d17]27
[4b1afb6]28# AC_SUBST([CONFIG_STATUS_DEPENDENCIES], ['$(top_srcdir)/version'])
[47a8d17]29AC_DEFINE_UNQUOTED(CFA_VERSION_MAJOR, ${ver_major}, [Major version number.])
30AC_DEFINE_UNQUOTED(CFA_VERSION_MINOR, ${ver_minor}, [Minor version number.])
31AC_DEFINE_UNQUOTED(CFA_VERSION_PATCH, ${ver_patch}, [Patch version number.])
32AC_DEFINE_UNQUOTED(CFA_VERSION_BUILD, ${ver_build}, [Build version number.])
[4b1afb6]33AC_DEFINE_UNQUOTED(CFA_VERSION_SHORT, ["${ver_major}"], [Major])
34AC_DEFINE_UNQUOTED(CFA_VERSION, ["${ver_major}.${ver_minor}"], [Major.Minor])
35AC_DEFINE_UNQUOTED(CFA_VERSION_LONG, ["${ver_major}.${ver_minor}.${ver_patch}"], [Major.Minor.Patch])
36AC_DEFINE_UNQUOTED(CFA_VERSION_FULL, ["${ver_major}.${ver_minor}.${ver_patch}.${ver_build}"], [Major.Minor.Patch.Build])
[ec129c4]37
[5d6ce1f]38# Installation paths
39
[ef7d253]40AC_ARG_WITH(backend-compiler,
41        [  --with-backend-compiler=PROGRAM     PROGRAM that performs the final code compilation (must be gcc-compatible) ],
[e24f13a]42        backendcompiler=$withval, backendcompiler="")
[6e4b913]43if test "x$backendcompiler" != "x"; then
[e24f13a]44        BACKEND_CC=${backendcompiler}
45else
[6e4b913]46        AC_PATH_PROG(BACKEND_CC, gcc, [])       # check gcc installed
[e24f13a]47        if test "x$BACKEND_CC" = "x"; then
[00cc023]48                AC_MSG_ERROR(some version of gcc is needed. Get it at ftp://ftp.gnu.org)
49                exit 1
50        fi
[e24f13a]51fi
52AC_DEFINE_UNQUOTED(CFA_BACKEND_CC, "${BACKEND_CC}", [Location of include files.])
53AC_SUBST(CFA_BACKEND_CC)
[5d6ce1f]54
[9def87a]55
56
57AC_ARG_ENABLE(target-release, AS_HELP_STRING([--enable-target-release], [Build and install the release target]))
58AC_ARG_ENABLE(target-debug, AS_HELP_STRING([--enable-target-debug], [Build and install the debug target]))
59
60case "$enable_target_release" in
61        yes)
62                case "$enable_target_debug" in
63                        yes)
64                                build_release="yes"
65                                build_debug="yes"
66                                ;;
67                        no)
68                                build_release="yes"
69                                build_debug="no"
70                                ;;
71                        *)
72                                build_release="yes"
73                                build_debug="no"
74                                ;;
75                esac
76                ;;
77        no)
78                case "$enable_target_debug" in
79                        yes)
80                                build_release="no"
81                                build_debug="yes"
82                                ;;
83                        no)
84                                AC_MSG_ERROR(Must build target debug or release)
85                                exit 1;
86                                ;;
87                        *)
88                                build_release="no"
89                                build_debug="yes"
90                                ;;
91                esac
92                ;;
93        *)
94                case "$enable_target_debug" in
95                        yes)
96                                build_release="no"
97                                build_debug="yes"
98                                ;;
99                        no)
100                                build_release="yes"
101                                build_debug="no"
102                                ;;
103                        *)
104                                build_release="yes"
105                                build_debug="yes"
106                                ;;
107                esac
108                ;;
109esac
110
111AM_CONDITIONAL([BUILD_RELEASE], [test "x$build_release" = "xyes"])
112AM_CONDITIONAL([BUILD_DEBUG], [test "x$build_debug" = "xyes"])
113
[5d6ce1f]114if test "x$prefix" = "xNONE"; then
[00cc023]115        cfa_prefix=${ac_default_prefix}
[5d6ce1f]116else
[00cc023]117        cfa_prefix=${prefix}
[ef7d253]118fi
[d3b7937]119AC_DEFINE_UNQUOTED(CFA_PREFIX, "${cfa_prefix}", [Location of cfa install.])
[00cc023]120AC_SUBST(CFA_PREFIX, ${cfa_prefix})
[5d6ce1f]121
122if test "$includedir" = '${prefix}/include'; then
123        cfa_incdir="${cfa_prefix}/include"
124else
[faf8857]125        cfa_incdir=${includedir}
[ef7d253]126fi
[5d6ce1f]127AC_DEFINE_UNQUOTED(CFA_INCDIR, "${cfa_incdir}", [Location of include files.])
[00cc023]128AC_SUBST(CFA_INCDIR, ${cfa_incdir})
[5d6ce1f]129
130if test "$bindir" = '${exec_prefix}/bin'; then
131        cfa_bindir="${cfa_prefix}/bin"
132else
133        cfa_bindir=${bindir}
[ef7d253]134fi
[5d6ce1f]135AC_DEFINE_UNQUOTED(CFA_BINDIR, "${cfa_bindir}", [Location of cfa command.])
[00cc023]136AC_SUBST(CFA_BINDIR, ${cfa_bindir})
[5d6ce1f]137
138if test "$libdir" = '${exec_prefix}/lib'; then
139        cfa_libdir=${cfa_prefix}/lib
140else
141        cfa_libdir=${libdir}
[ef7d253]142fi
[5d6ce1f]143AC_DEFINE_UNQUOTED(CFA_LIBDIR, "${cfa_libdir}", [Location of cc1 and cfa-cpp commands.])
[00cc023]144AC_SUBST(CFA_LIBDIR, ${cfa_libdir})
[5d6ce1f]145
[6e4b913]146AC_DEFINE_UNQUOTED(CFA_FLAGS, "${CFAFLAGS}", [compilation flags for cfa libraries and test programs.])
147AC_SUBST(CFA_FLAGS, ${CFAFLAGS})
148
[e4745d7a]149AC_CANONICAL_HOST
150AC_SUBST([MACHINE_TYPE],[$host_cpu])
151
[5d6ce1f]152# Checks for programs.
153AC_PROG_CXX
154AC_PROG_CC
[8e5724e]155AM_PROG_AS
[00cc023]156AM_PROG_CC_C_O  # deprecated
[c3a4385]157# These are often not installed and people miss seeing the "no", so stop the configure.
[56c3935]158AC_PROG_YACC
[c3a4385]159if test "${YACC}" = "yacc" ; then echo "Error: bison required." ; exit 1 ; fi
[56c3935]160AC_PROG_LEX
[c3a4385]161if test "${LEX}" = "lex" ; then echo "Error: flex required." ; exit 1 ; fi
[5d6ce1f]162AC_PROG_INSTALL
163AC_PROG_MAKE_SET
[00cc023]164AC_PROG_RANLIB
[5d6ce1f]165
166# Checks for libraries.
167
168# Checks for header files.
169AC_FUNC_ALLOCA
170AC_CHECK_HEADERS([fenv.h float.h inttypes.h libintl.h limits.h malloc.h stddef.h stdlib.h string.h unistd.h])
171
172# Checks for typedefs, structures, and compiler characteristics.
173AC_HEADER_STDBOOL
174AC_C_INLINE
175AC_TYPE_INT16_T
176AC_TYPE_INT32_T
177AC_TYPE_INT8_T
178AC_C_RESTRICT
179AC_TYPE_SIZE_T
180AC_TYPE_UINT16_T
181AC_TYPE_UINT32_T
182AC_TYPE_UINT8_T
183
184# Checks for library functions.
185AC_CHECK_FUNCS([memset putenv strchr strtol])
186
[00cc023]187AC_CONFIG_FILES([
188        Makefile
[6e7e2b36]189        src/driver/Makefile
[00cc023]190        src/Makefile
191        src/examples/Makefile
[ef7d253]192        src/tests/Makefile
[6e7e2b36]193        src/libcfa/Makefile
[00cc023]194        ])
[5d6ce1f]195
196AC_OUTPUT
[7e91d4f]197
[9def87a]198AM_COND_IF([BUILD_RELEASE],
199        [AM_COND_IF([BUILD_DEBUG],
200                [AC_MSG_NOTICE(Building libcfa for target: release & debug)],
201                [AC_MSG_NOTICE(Building libcfa for target: release)])],
202        [AC_MSG_NOTICE(Building libcfa for target: debug)])
203
[5d6ce1f]204# Final text
205AC_MSG_RESULT(Cforall configuraton completed. Type "make -j 8 install".)
Note: See TracBrowser for help on using the repository browser.