source: configure.ac @ 534e4e4

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

Some clean-up before tackling finding directories

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