source: configure.ac @ 0c1b566

aaron-thesisarm-ehcleanup-dtorsdeferred_resndemanglerjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprno_listpersistent-indexer
Last change on this file since 0c1b566 was 0c1b566, checked in by Thierry Delisle <tdelisle@…>, 3 years ago

Fixed missing foreign options and tentative fix for TOP directories defines

  • Property mode set to 100644
File size: 7.5 KB
Line 
1#                                               -*- Autoconf -*-
2# Process this file with autoconf to produce a configure script.
3
4AC_PREREQ([2.68])
5AC_INIT([cfa-cc],[1.0.0.0],[cforall@plg.uwaterloo.ca])
6AC_CONFIG_AUX_DIR([automake])
7#AC_CONFIG_SRCDIR([src/main.cc])
8AC_CONFIG_HEADERS([config.h:src/config.h.in])
9AM_SILENT_RULES([yes])
10
11m4_include([automake/cfa.m4])
12
13# don't use the default CFLAGS as they unconditonnaly add -O2
14: ${CFLAGS=""}
15
16AM_INIT_AUTOMAKE([subdir-objects])
17
18# Allow program name tansformation
19# will fill program_transform_name with appropriate sed regex
20AC_ARG_PROGRAM
21
22#==============================================================================
23#Trasforming cc1 will break compilation
24M4CFA_PROGRAM_NAME
25
26#==============================================================================
27# version information
28
29rm -f version
30echo ${PACKAGE_VERSION} > version               # file containing version number for other tools
31chmod ugo-w version
32ver_major=`cut -d '.' -f1 version`              # subdivide version number into components at periods
33ver_minor=`cut -d '.' -f2 version`
34ver_patch=`cut -d '.' -f3 version`
35ver_build=`cut -d '.' -f4 version`
36
37# AC_SUBST([CONFIG_STATUS_DEPENDENCIES], ['$(top_srcdir)/version'])
38AC_DEFINE_UNQUOTED(CFA_VERSION_MAJOR, ${ver_major}, [Major version number.])
39AC_DEFINE_UNQUOTED(CFA_VERSION_MINOR, ${ver_minor}, [Minor version number.])
40AC_DEFINE_UNQUOTED(CFA_VERSION_PATCH, ${ver_patch}, [Patch version number.])
41AC_DEFINE_UNQUOTED(CFA_VERSION_BUILD, ${ver_build}, [Build version number.])
42AC_DEFINE_UNQUOTED(CFA_VERSION_SHORT, ["${ver_major}"], [Major])
43AC_DEFINE_UNQUOTED(CFA_VERSION, ["${ver_major}.${ver_minor}"], [Major.Minor])
44AC_DEFINE_UNQUOTED(CFA_VERSION_LONG, ["${ver_major}.${ver_minor}.${ver_patch}"], [Major.Minor.Patch])
45AC_DEFINE_UNQUOTED(CFA_VERSION_FULL, ["${ver_major}.${ver_minor}.${ver_patch}.${ver_build}"], [Major.Minor.Patch.Build])
46
47#==============================================================================
48# HACK to be able to use conditionnals inside makefiles
49DOifskipcompile='ifeq ($(skipcompile),yes)
50else'
51AC_SUBST([DOifskipcompile])
52AM_SUBST_NOTMAKE([DOifskipcompile])
53
54DOendif='endif'
55AC_SUBST([DOendif])
56AM_SUBST_NOTMAKE([DOendif])
57
58#==============================================================================
59# backend compiler implementation
60AC_ARG_WITH(backend-compiler,
61       [  --with-backend-compiler=PROGRAM     PROGRAM that performs the final code compilation (must be gcc-compatible) ],
62       backendcompiler=$withval, backendcompiler="")
63if test "x$backendcompiler" != "x"; then
64       BACKEND_CC=${backendcompiler}
65else
66       AC_PATH_PROG(BACKEND_CC, gcc, [])       # check gcc installed
67       if test "x$BACKEND_CC" = "x"; then
68               AC_MSG_ERROR(some version of gcc is needed. Get it at ftp://ftp.gnu.org)
69               exit 1
70       fi
71fi
72AC_DEFINE_UNQUOTED(CFA_BACKEND_CC, "${BACKEND_CC}", [Location of include files.])
73AC_SUBST(CFA_BACKEND_CC)
74
75#==============================================================================
76# Installation paths
77M4CFA_PARSE_PREFIX
78
79#==============================================================================
80# Create variables for commonly used targets
81
82TOP_SRCDIR=$(readlink -f $ac_confdir/)
83TOP_BUILDDIR=$(readlink -f $ac_pwd/)
84
85echo ${TOP_SRCDIR}
86echo ${TOP_BUILDDIR}
87
88AC_DEFINE_UNQUOTED(TOP_SRCDIR, "$TOP_SRCDIR", [Top src directory])
89AC_DEFINE_UNQUOTED(TOP_BUILDDIR, "$TOP_BUILDDIR", [Top build directory])
90
91DRIVER_DIR=${TOP_BUILDDIR}driver/
92CFACC=${DRIVER_DIR}cfa
93CFACPP=${DRIVER_DIR}cfa-cpp
94AC_SUBST(DRIVER_DIR)
95AC_SUBST(CFACC)
96AC_SUBST(CFACPP)
97
98#==============================================================================
99# Flag variables needed to build in tree
100LIBCFA_SRC='${TOP_SRCDIR}/libcfa/src'
101BUILD_IN_TREE_FLAGS="-XCFA -t -B${DRIVER_DIR}"
102AC_SUBST(BUILD_IN_TREE_FLAGS)
103
104#==============================================================================
105# handle the list of hosts to build for
106for var in $ac_configure_args
107do
108        #strip quotes surrouding values
109        case $var in
110                # skip cross compilation related arguments
111                \'--host=*) ;; \'host_alias=*) ;; \'--build=*) ;; \'build_alias=*) ;; \'--target=*) ;; \'target_alias=*) ;;
112
113                # skip the target hosts
114                \'--with-target-hosts=*) ;;
115
116                # append all other arguments to the sub configure arguments
117                *) LIBCFA_GENERAL_ARGS="${LIBCFA_GENERAL_ARGS} $var";;
118        esac
119done
120
121#==============================================================================
122# handle the list of hosts to build for
123AC_CANONICAL_BUILD
124AC_CANONICAL_HOST
125
126default_target="${host_cpu}:debug, ${host_cpu}:nodebug"
127AC_ARG_WITH(target-hosts,
128        [  --with-target-hosts=HOSTS     HOSTS comma seperated list of hosts to build for, format ARCH:[debug|nodebug|nolib]],
129        target_hosts=$withval, target_hosts=${default_target})
130
131AC_SUBST(TARGET_HOSTS, ${target_hosts})
132
133LIBCFA_PATHS="DRIVER_DIR=${DRIVER_DIR}"
134
135for i in $(echo $target_hosts | sed "s/,/ /g")
136do
137        # call your procedure/other scripts here below
138        arch_name=$(echo $i | sed -r "s/:(.*)//g")
139        lib_config=$(echo $i | sed -r "s/(.*)://g")
140
141        case $lib_config in
142                "nodebug") ;;
143                "debug") ;;
144                "nolib") ;;
145                *)
146                        >&2 echo "Configuration must be 'debug', 'nodebug' or 'nolib'"
147                        exit 1
148                ;;
149        esac
150
151        M4CFA_CANNON_CPU([${arch_name}])
152        lib_arch=${cannon_arch_name}
153        lib_dir="libcfa/${lib_arch}-${lib_config}"
154
155        LIBCFA_TARGET_DIRS="${LIBCFA_TARGET_DIRS} ${lib_dir}"
156        LIBCFA_TARGET_MAKEFILES="${LIBCFA_TARGET_MAKEFILES} ${lib_dir}/Makefile"
157
158        mkdir -p ${lib_dir}
159        echo -n "${LIBCFA_GENERAL_ARGS} " > ${lib_dir}/config.data
160        echo -n "${LIBCFA_PATHS} " >> ${lib_dir}/config.data
161        echo -n "ARCHITECTURE=${lib_arch} " >> ${lib_dir}/config.data
162        echo -n "CONFIGURATION=${lib_config}" >> ${lib_dir}/config.data
163done
164
165AC_SUBST(LIBCFA_TARGET_DIRS)
166AC_SUBST(LIBCFA_TARGET_MAKEFILES)
167
168M4CFA_CANNON_CPU([${host_cpu}])
169AC_DEFINE_UNQUOTED(CFA_DEFAULT_CPU, "$cannon_arch_name", [Default cpu to use if neither -m32 or -m64 are defined.])
170AC_DEFINE_UNQUOTED(CFA_64_CPU, "x64", [CPU to use if the -m64 flags is given.])
171AC_DEFINE_UNQUOTED(CFA_32_CPU, "x86", [CPU to use if the -m32 flags is given.])
172
173#==============================================================================
174# CAFLAGS
175AC_DEFINE_UNQUOTED(CFA_FLAGS, "${CFAFLAGS}", [compilation flags for cfa libraries and test programs.])
176AC_SUBST(CFA_FLAGS, ${CFAFLAGS})
177
178#==============================================================================
179# Checks for programs.
180AC_PROG_CXX
181AC_PROG_CC
182AM_PROG_AS
183AM_PROG_CC_C_O  # deprecated
184# These are often not installed and people miss seeing the "no", so stop the configure.
185AC_PROG_YACC
186if test "${YACC}" = "yacc" ; then echo "Error: bison required." ; exit 1 ; fi
187AC_PROG_LEX
188if test "${LEX}" = "lex" ; then echo "Error: flex required." ; exit 1 ; fi
189AC_PROG_INSTALL
190AC_PROG_MAKE_SET
191AC_PROG_RANLIB
192
193# Checks for libraries.
194
195# Checks for header files.
196AC_FUNC_ALLOCA
197AC_CHECK_HEADERS([fenv.h float.h inttypes.h libintl.h limits.h malloc.h stddef.h stdlib.h string.h unistd.h])
198
199# Checks for typedefs, structures, and compiler characteristics.
200AC_HEADER_STDBOOL
201AC_C_INLINE
202AC_TYPE_INT16_T
203AC_TYPE_INT32_T
204AC_TYPE_INT8_T
205AC_C_RESTRICT
206AC_TYPE_SIZE_T
207AC_TYPE_UINT16_T
208AC_TYPE_UINT32_T
209AC_TYPE_UINT8_T
210
211# Checks for library functions.
212AC_CHECK_FUNCS([memset putenv strchr strtol])
213
214#==============================================================================
215AC_CONFIG_FILES([
216        Makefile
217        driver/Makefile
218        src/Makefile
219        benchmark/Makefile
220        tests/Makefile
221        tests/preempt_longrun/Makefile
222        tools/Makefile
223        tools/prettyprinter/Makefile
224        ])
225
226AC_CONFIG_LINKS([tests/test.py:tests/test.py])
227
228AC_OUTPUT(tests/config.py)
229
230# Final text
231AC_MSG_RESULT(Cforall configuraton completed. Type "make -j 8 install".)
Note: See TracBrowser for help on using the repository browser.