source: configure.ac @ 4dcaed2

ADTaaron-thesisarm-ehast-experimentalcleanup-dtorsdeferred_resndemanglerenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprno_listpersistent-indexerpthread-emulationqualifiedEnum
Last change on this file since 4dcaed2 was 4dcaed2, checked in by Thierry Delisle <tdelisle@…>, 6 years ago

Added prelude-dir argument for cfa-cpp

  • Property mode set to 100644
File size: 7.7 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/
92
93AC_DEFINE_UNQUOTED(TOP_SRCDIR, "$TOP_SRCDIR", [Top src directory])
94AC_DEFINE_UNQUOTED(TOP_BUILDDIR, "$TOP_BUILDDIR", [Top build directory])
95
96DRIVER_DIR=${TOP_BUILDDIR}driver/
97CFACC=${DRIVER_DIR}cfa
98CFACPP=${DRIVER_DIR}cfa-cpp
99AC_SUBST(DRIVER_DIR)
100AC_SUBST(CFACC)
101AC_SUBST(CFACPP)
102
103#==============================================================================
104# Flag variables needed to build in tree
105LIBCFA_SRC='${TOP_SRCDIR}/libcfa/src'
106BUILD_IN_TREE_FLAGS="-XCFA -t -B${DRIVER_DIR}"
107AC_SUBST(BUILD_IN_TREE_FLAGS)
108
109#==============================================================================
110# handle the list of hosts to build for
111for var in $ac_configure_args
112do
113        #strip quotes surrouding values
114        case $var in
115                # skip cross compilation related arguments
116                \'--host=*) ;; \'host_alias=*) ;; \'--build=*) ;; \'build_alias=*) ;; \'--target=*) ;; \'target_alias=*) ;;
117
118                # skip the target hosts
119                \'--with-target-hosts=*) ;;
120
121                # append all other arguments to the sub configure arguments
122                *) LIBCFA_GENERAL_ARGS="${LIBCFA_GENERAL_ARGS} $var";;
123        esac
124done
125
126#==============================================================================
127# handle the list of hosts to build for
128AC_CANONICAL_BUILD
129AC_CANONICAL_HOST
130
131default_target="${host_cpu}:debug, ${host_cpu}:nodebug"
132AC_ARG_WITH(target-hosts,
133        [  --with-target-hosts=HOSTS     HOSTS comma seperated list of hosts to build for, format ARCH:[debug|nodebug|nolib]],
134        target_hosts=$withval, target_hosts=${default_target})
135
136AC_SUBST(TARGET_HOSTS, ${target_hosts})
137
138LIBCFA_PATHS="DRIVER_DIR=${DRIVER_DIR}"
139
140for i in $(echo $target_hosts | sed "s/,/ /g")
141do
142        # call your procedure/other scripts here below
143        arch_name=$(echo $i | sed -r "s/:(.*)//g")
144        lib_config=$(echo $i | sed -r "s/(.*)://g")
145        if test $lib_config != "nodebug";
146        then
147                if test $lib_config != "debug";
148                then
149                        if test $lib_config != "nolib";
150                        then
151                                >&2 echo "Configuration must be 'debug', 'nodebug' or 'nolib'"
152                                exit 1
153                        fi
154                fi
155        fi
156
157        lib_arch=$($ac_aux_dir/config.sub $arch_name)
158        if test "$?" != "0"; then
159                >&2 echo "Unkown architecture " $arch_name;
160                exit 1;
161        fi
162        lib_dir="libcfa-${lib_arch}-${lib_config}"
163
164        LIBCFA_TARGET_DIRS="${LIBCFA_TARGET_DIRS} ${lib_dir}"
165        LIBCFA_TARGET_MAKEFILES="${LIBCFA_TARGET_MAKEFILES} ${lib_dir}/Makefile"
166
167        mkdir -p libcfa-${lib_arch}-${lib_config}
168        echo -n "${LIBCFA_GENERAL_ARGS} " > libcfa-${lib_arch}-${lib_config}/config.data
169        echo -n "${LIBCFA_PATHS} " >> libcfa-${lib_arch}-${lib_config}/config.data
170        echo -n "--host=${lib_arch} " >> libcfa-${lib_arch}-${lib_config}/config.data
171        echo -n "CONFIGURATION=${lib_config}" >> libcfa-${lib_arch}-${lib_config}/config.data
172done
173
174AC_SUBST(LIBCFA_TARGET_DIRS)
175AC_SUBST(LIBCFA_TARGET_MAKEFILES)
176
177#==============================================================================
178# CAFLAGS
179AC_DEFINE_UNQUOTED(CFA_FLAGS, "${CFAFLAGS}", [compilation flags for cfa libraries and test programs.])
180AC_SUBST(CFA_FLAGS, ${CFAFLAGS})
181
182#==============================================================================
183# Checks for programs.
184AC_PROG_CXX
185AC_PROG_CC
186AM_PROG_AS
187AM_PROG_CC_C_O  # deprecated
188# These are often not installed and people miss seeing the "no", so stop the configure.
189AC_PROG_YACC
190if test "${YACC}" = "yacc" ; then echo "Error: bison required." ; exit 1 ; fi
191AC_PROG_LEX
192if test "${LEX}" = "lex" ; then echo "Error: flex required." ; exit 1 ; fi
193AC_PROG_INSTALL
194AC_PROG_MAKE_SET
195AC_PROG_RANLIB
196
197# Checks for libraries.
198
199# Checks for header files.
200AC_FUNC_ALLOCA
201AC_CHECK_HEADERS([fenv.h float.h inttypes.h libintl.h limits.h malloc.h stddef.h stdlib.h string.h unistd.h])
202
203# Checks for typedefs, structures, and compiler characteristics.
204AC_HEADER_STDBOOL
205AC_C_INLINE
206AC_TYPE_INT16_T
207AC_TYPE_INT32_T
208AC_TYPE_INT8_T
209AC_C_RESTRICT
210AC_TYPE_SIZE_T
211AC_TYPE_UINT16_T
212AC_TYPE_UINT32_T
213AC_TYPE_UINT8_T
214
215# Checks for library functions.
216AC_CHECK_FUNCS([memset putenv strchr strtol])
217
218#==============================================================================
219AC_CONFIG_FILES([
220        Makefile
221        driver/Makefile
222        src/Makefile
223        benchmark/Makefile
224        tests/Makefile
225        tests/preempt_longrun/Makefile
226        tools/Makefile
227        tools/prettyprinter/Makefile
228        ])
229
230AC_CONFIG_LINKS([tests/test.py:tests/test.py])
231
232AC_OUTPUT(tests/config.py)
233
234# Final text
235AC_MSG_RESULT(Cforall configuraton completed. Type "make -j 8 install".)
Note: See TracBrowser for help on using the repository browser.