-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathconfigure.ac
209 lines (181 loc) · 6.61 KB
/
configure.ac
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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
# Copyright (C) 2011-2014 Melissa Gymrek <[email protected]>
#
# This file is free software; as a special exception the author gives
# unlimited permission to copy and/or distribute it, with or without
# modifications, as long as this notice is preserved.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
AC_INIT([lobSTR],
m4_esyscmd([config/git-version-gen .tarball-version]),
[Melissa Gymrek [email protected]],
[lobSTR])
AC_CONFIG_AUX_DIR(config)
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_HEADER(config.h)
AC_CONFIG_SRCDIR([src/main.cpp])
AM_INIT_AUTOMAKE([foreign subdir-objects])
# Detect host (used later for Darwin/Mac-OS detection)
AC_CANONICAL_HOST
LT_INIT([static])
AC_PROG_CC
AC_PROG_CXX
AC_PROG_INSTALL
## Check for GSL (GNU Scientific Library)
PKG_CHECK_MODULES([GSL],[gsl])
AX_PTHREAD([],[
AC_MSG_ERROR([Pthread support is required for LobSTR])
])
AX_CHECK_ZLIB()
# Detect Mac-OS-X systems, and set USE_MACOS_DISPATCH in 'config.h'
# This value is used in './src/xsemaphore.h' .
AS_CASE([$host],
[*-*-darwin*], [MT_USE_DISTACH=yes]
[MT_USE_DISPATCH=""]
)
if test "x$MT_USE_DISTACH" = "xyes" ; then
AC_DEFINE([USE_MACOS_DISPTACH], 1, [True if compiling on Mac-OS-X, need to use dispatch/semaphore.h])
fi
AX_BOOST_BASE([1.38.0])
PKG_CHECK_MODULES([CPPUNIT],[cppunit])
# Checks for header files.
AC_CHECK_HEADERS([stdlib.h string.h unistd.h])
# BamTools needs HAVE_FSEEK64
AC_SYS_LARGEFILE
AC_FUNC_FSEEKO
AC_CHECK_FUNCS(fseek64, xpdf_cv_func_fseek64=yes, xpdf_cv_func_fseek64=no)
AC_CHECK_FUNCS(ftell64, xpdf_cv_func_ftell64=yes, xpdf_cv_func_ftell64=no)
if test "$xpdf_cv_func_fseek64" = yes -a "$xpdf_cv_func_ftell64" = yes; then
AC_DEFINE(HAVE_FSEEK64)
fi
# To compile a static executable (before binary packaging?),
# use:
# ./configure --enable-all-static
#
# NOTE:
# 1. Using "./configure LDFLAGS=-static" will not work, because
# libtool will override the LDFLAG files at times.
# 2. The flag 'LT_LDFLAGS' is used in ./src/Makefile.am with LDADD.
#
# 'all-static' marco copied from subversion's configure.ac
AC_ARG_ENABLE(all-static,
AS_HELP_STRING([--enable-all-static],
[Build completely static (standalone) binaries.]),
[
if test "$enableval" = "yes" ; then
LT_LDFLAGS="-all-static $LT_LDFLAGS"
elif test "$enableval" != "no" ; then
AC_MSG_ERROR([--enable-all-static doesn't accept argument])
fi
])
AC_SUBST(LT_LDFLAGS)
# Add Debian-specific Hardening flags
# See: https://wiki.debian.org/HardeningWalkthrough
# Requires 'dpkg-buildflags' from the 'dpkg-dev' package
#
# To use:
# ./configure --enable-debian-hardening
#
AC_ARG_ENABLE(debian-hardening,
AS_HELP_STRING([--enable-debian-hardening],
[Build with Debian-specific hardening flags]),
[
if test "$enableval" = "yes" ; then
:
elif test "$enableval" != "no" ; then
AC_MSG_ERROR([--enable-debian-hardening doesn't accept argument])
fi
])
AC_CHECK_PROG([DPKG_BUILDFLAGS],[dpkg-buildflags],[yes],[no],[])
if test "x$enable_debian_hardening" = "xyes" ; then
if test "x$DPKG_BUILDFLAGS" != "xyes" ; then
AC_MSG_ERROR([debian-hardening requires the program dpkg-buildflag, which was not found])
fi
DEBHARD_CFLAGS=`dpkg-buildflags --get CFLAGS`
DEBHARD_CXXFLAGS=`dpkg-buildflags --get CXXFLAGS`
DEBHARD_CPPFLAGS=`dpkg-buildflags --get CPPFLAGS`
DEBHARD_LDFLAGS=`dpkg-buildflags --get LDFLAGS`
fi
# Set variables using shell commands
GIT_VERSION=${PACKAGE_VERSION}
AC_SUBST(GIT_VERSION)
MACHTYPE=`uname -m`
AC_SUBST(MACHTYPE)
## Add --enable-werror option to ./configure,
## To enable/disable treating compiler warnings as errors.
## If not specified AND we're compiling from .git repository,
## enable this automatically.
AC_ARG_ENABLE([werror],
[AS_HELP_STRING([--enable-werror],
[treat compiler warnings as errors (for developers)])],
[case $enableval in
yes|no) ;;
*) AC_MSG_ERROR([bad value $enableval for werror option]) ;;
esac
werror=$enableval],
[]
)
if test "$werror" = yes; then
WERROR_CFLAGS="-Werror"
AC_SUBST([WERROR_CFLAGS])
fi
# Add pThread related settings,
# see http://www.gnu.org/software/autoconf-archive/ax_pthread.html
# NOTE: CFLAGS/CXXFLAGS are also updated below.
LIBS="$PTHREAD_LIBS $LIBS"
# Compiler warnings to add
COMPILER_WARNINGS="-Wall -Wextra -Wswitch-default -Wno-strict-aliasing"
# Add an additional flag if using CLANG
AC_MSG_CHECKING([if compiling with clang])
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([], [[
#ifndef __clang__
not clang
#endif
]])],
[CLANG=yes], [CLANG=no])
AC_MSG_RESULT([$CLANG])
if test "x$CLANG" = "xyes"; then
COMPILER_WARNINGS="$COMPILER_WARNINGS -Wno-error=unused-command-line-argument"
fi
# Custom Flags to add to CFLAGS/CXXFLAGS
LOBSTR_CFLAGS="-D_GIT_VERSION=\"\\\"${GIT_VERSION}\\\"\" -D_MACHTYPE=\"\\\"${MACHTYPE}\\\"\""
# Set the final value for CFLAGS/CXXFLAGS
CFLAGS="$CFLAGS $COMPILER_WARNINGS $PTHREAD_CFLAGS $LOBSTR_CFLAGS"
CXXFLAGS="$CXXFLAGS $COMPILER_WARNINGS $PTHREAD_CFLAGS $LOBSTR_CFLAGS $BOOST_CPPFLAGS"
# Add Debian-Hardning flags
if test "x$enable_debian_hardening" = "xyes" ; then
CFLAGS="$CFLAGS $DEBHARD_CFLAGS"
CXXFLAGS="$CXXFLAGS $DEBHARD_CXXFLAGS"
CPPFLAGS="$CPPFLAGS $DEBHARD_CPPFLAGS"
LDFLAGS="$LDFLAGS $DEBHARD_LDFLAGS"
fi
AC_CONFIG_FILES([
m4/Makefile
Makefile
src/Makefile
scripts/Makefile
models/Makefile
tests/Makefile
])
AC_OUTPUT
dnl
dnl Report Configuration
dnl
AC_MSG_RESULT([])
AC_MSG_RESULT([ Configuration summary for $PACKAGE])
AC_MSG_RESULT([ version $VERSION])
AC_MSG_RESULT([ CFLAGS: $CFLAGS])
AC_MSG_RESULT([ CPPFLAGS: $CPPFLAGS])
AC_MSG_RESULT([ CXXFLAGS: $CXXFLAGS])
AC_MSG_RESULT([ LDFLAGS: $LDFLAGS])
AC_MSG_RESULT([])
AC_MSG_RESULT([ Default installtion directories:])
AC_MSG_RESULT([ programs: ${prefix}/bin/ ])
AC_MSG_RESULT([ support scripts: ${prefix}/share/$PACKAGE/scripts])
AC_MSG_RESULT([ pre-computed model files: ${prefix}/share/$PACKAGE/models])
AC_MSG_RESULT([])
AC_MSG_RESULT([ To change installtion path, use:])
AC_MSG_RESULT([ ./configure --prefix NEW-PATH])
AC_MSG_RESULT([])