source: configure.ac @ ff1e0f38

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

configure flags are now propagated properly to libcfa

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