-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathconfigure.ac
More file actions
executable file
·145 lines (122 loc) · 4.52 KB
/
configure.ac
File metadata and controls
executable file
·145 lines (122 loc) · 4.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
AC_INIT([stringfish],[0.13.2 traversc@gmail.com])
AC_PATH_PROG([PKGCONF],[pkg-config],[],[$PATH:/usr/local/bin:ext/bin:ext:/sw/bin:/opt/bin:/opt/local/bin])
echo "stringfish configure script"
########################################################
### Predefined compile strings for different cases
ADD_LIBS=""
INCLUDE_PATHS=""
LIBPCRE2=""
PCRE2_BUNDLED=""
########################################################
### Configure args
AC_ARG_WITH([pcre2-force-compile],
AS_HELP_STRING([--with-pcre2-force-compile],[Force compilation of bundled pcre2 source files]),
[pcre2_force_compile="true"])
AC_ARG_WITH([pcre2-include],
AS_HELP_STRING([--with-pcre2-include=INCLUDE_PATH],[the location of pcre2 header files]),
[pcre2_include_path=$withval])
AC_ARG_WITH([pcre2-lib],
AS_HELP_STRING([--with-pcre2-lib=LIB_PATH],[the location of pcre2 library files]),
[pcre2_lib_path=$withval])
AC_ARG_WITH([simd],
AS_HELP_STRING([--with-simd],[Manually select SIMD support (options: AVX2)]),
[with_simd=$withval])
########################################################
#### Version value function
getVersion()
{
VERSION_STRING=$1
MAJOR=`echo $VERSION_STRING | cut -d. -f1`
MINOR=`echo $VERSION_STRING | cut -d. -f2`
echo $(($MAJOR*1000+$MINOR))
}
########################################################
#### Check for GCC version and add -mshstk cflags for GCC 8+
#### ver 0.13.2 -- no longer in use
# echo "Testing for C compiler version"
# echo "R_HOME: $R_HOME"
# : ${R_HOME=`R RHOME`}
# echo "R_HOME: $R_HOME"
# if test -z "${R_HOME}"; then
# echo "could not determine R_HOME"
# exit 1
# fi
# CC=`"${R_HOME}/bin/R" CMD config CC`
# echo "C compiler command: $CC"
# AC_LANG(C)
# AX_CHECK_COMPILE_FLAG([-mshstk],[MSHSTK_FLAG_AVAIL=yes])
# if test xx$MSHSTK_FLAG_AVAIL = "xxyes"; then
# ADD_CFLAGS="${ADD_CFLAGS} -mshstk"
# fi
# AC_LANG(C)
# AX_COMPILER_VENDOR
# AX_COMPILER_VERSION
# echo "C compiler vendor: $ax_cv_c_compiler_vendor"
# echo "C compiler version: $ax_cv_c_compiler_version" # note: The version is completely wrong for Mac LLVM
# if test xx$ax_cv_c_compiler_vendor = "xxgnu"; then
# CCVER=`${CC} -dumpversion | cut -f 1 -d "."`
# echo "gcc dumpversion: $CCVER"
# if test "${CCVER}" -ge 8; then
# ADD_CFLAGS="${ADD_CFLAGS} -mshstk"
# fi
# elif test xx$ax_cv_c_compiler_vendor == "xxclang"; then
# CCVER=`${CC} -dumpversion | cut -f 1 -d "."`
# echo "clang dumpversion: $CCVER"
# if test "${CCVER}" -ge 9; then
# ADD_CFLAGS="${ADD_CFLAGS} -mshstk"
# fi
# fi
########################################################
#### PCRE2 library paths
if test xx$pcre2_force_compile = "xxtrue"; then
echo "Compiling PCRE2 from source due to --with-pcre2-force-compile"
COMPILE_PCRE2="true"
elif test "xx$pcre2_include_path" != "xx"; then
echo "Using user-defined pcre2 install paths"
ADD_LIBS="${ADD_LIBS} -L${pcre2_lib_path}"
INCLUDE_PATHS="${INCLUDE_PATHS} -I${pcre2_include_path}"
COMPILE_PCRE2="false"
elif test "xx$PKGCONF" != "xx"; then
if "${PKGCONF}" --exists libpcre2-8; then
VERSION_STRING=`${PKGCONF} --modversion libpcre2-8`
VER=`getVersion ${VERSION_STRING}`
if test "${VER}" -ge 10035; then
echo "PCRE2 ${VERSION_STRING} library detected -- skipping PCRE2 compilation"
pcre2_lib_path=`"${PKGCONF}" --libs libpcre2-8`
pcre2_include_path=`"${PKGCONF}" --cflags-only-I libpcre2-8`
ADD_LIBS="${ADD_LIBS} ${pcre2_lib_path}"
INCLUDE_PATHS="${INCLUDE_PATHS} ${pcre2_include_path}"
COMPILE_PCRE2="false"
else
echo "PCRE2 ${VERSION_STRING} library detected but is lower than bundled version (10.35) -- compiling from source"
COMPILE_PCRE2="true"
fi
else
echo "PCRE2 library not detected -- compiling from source"
COMPILE_PCRE2="true"
fi
else
echo "pkg-confg not detected -- compiling from source"
COMPILE_PCRE2="true"
fi
if test xx$COMPILE_PCRE2 = "xxtrue"; then
INCLUDE_PATHS="${INCLUDE_PATHS} -IPCRE2"
LIBPCRE2="\$(LIBPCRE2)"
PCRE2_BUNDLED="-DPCRE2_BUNDLED"
fi
if test xx$with_simd = "xxAVX2"; then
echo "Using AVX2"
INCLUDE_PATHS="$INCLUDE_PATHS -mavx2 -msse3 -msse2"
# elif test xx$with_simd = "xxSSE3"; then
# echo "Using SSE3"
# INCLUDE_PATHS="$INCLUDE_PATHS -msse3 -msse2"
fi
echo $ADD_LIBS
echo $INCLUDE_PATHS
echo $LIBPCRE2
AC_SUBST([ADD_LIBS], $ADD_LIBS)
AC_SUBST([INCLUDE_PATHS], $INCLUDE_PATHS)
AC_SUBST([LIBPCRE2], $LIBPCRE2)
AC_SUBST([PCRE2_BUNDLED], $PCRE2_BUNDLED)
AC_CONFIG_FILES([src/Makevars])
AC_OUTPUT