source: configure.ac @ 37fe352

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

Added proper multi-lib handling, tests still do not work and arm support is broken

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