forked from chris2511/xca
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
245 lines (213 loc) · 7.71 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
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
AC_INIT([X Certificate and Key management],
m4_esyscmd([tr -d '\n' < VERSION]),
[christian@hohnstaedt.de],
[xca],
[http://xca.hohnstaedt.de])
AC_MSG_NOTICE([ ***************************************************])
AC_MSG_NOTICE([ * ${PACKAGE_NAME} ${PACKAGE_VERSION}])
AC_MSG_NOTICE([ ***************************************************])
AC_CONFIG_MACRO_DIR([m4])
AC_PROG_CXX
AC_LANG(C++)
AC_CHECK_TOOL(STRIP, [strip], [:])
DVERSION="`${CXX} --version | grep apple-darwin || :`"
case "$DVERSION" in
*-apple-darwin*) DARWIN="true" ;;
esac
if test -n "${DARWIN}"; then
AC_MSG_NOTICE([Mac OSX detected])
CXXFLAGS="${CXXFLAGS} -pipe -gdwarf-2"
LIBS="${LIBS} -framework IOKit -framework CoreFoundation"
fi
AC_SUBST([DARWIN])
AC_SUBST([MACDEPLOYQT])
export PKG_CONFIG_PATH
export LD_LIBRARY_PATH
if test -n "$DARWIN"; then
export DYLD_LIBRARY_PATH
fi
if test "$srcdir" != "."; then
exist=""
for f in Local.mak local.h commithash.h; do
test ! -r "$srcdir"/"$f" || exist="$exist $f"
done
if test -n "$exist"; then
AC_ERROR([The source directory (${srcdir}) contains the file(s):$exist.
They must be removed before building here.])
fi
fi
# Detect the OpenSSL libraries and header
#########################################
AC_ARG_WITH([openssl],
AS_HELP_STRING([--with-openssl], [Select the OpenSSL installation directory]),
[ if test -d "$withval"; then
_OPENSSLDIR="$withval"
else
AC_MSG_WARN([OpenSSL directory '$withval' does not exist or is not a directory])
fi
], [_OPENSSLDIR="$OPENSSLDIR"])
if test -n "${_OPENSSLDIR}" && test -d "${_OPENSSLDIR}"; then
_OPENSSLDIR=`cd ${_OPENSSLDIR} && pwd`
PKG_CONFIG_PATH="${_OPENSSLDIR}/lib/pkgconfig:${PKG_CONFIG_PATH}"
LD_LIBRARY_PATH="${_OPENSSLDIR}/lib:${LD_LIBRARY_PATH}"
DYLD_LIBRARY_PATH="${_OPENSSLDIR}/lib:${DYLD_LIBRARY_PATH}"
fi
PKG_CHECK_MODULES([OpenSSL],
[libcrypto >= 0.9.8], [ ],
[
OpenSSL_LIBS=" -lcrypto ";
AC_MSG_WARN([OpenSSL pkg-config failed, using fallback defaults (${OpenSSL_LIBS})]);
]
)
OPENSSL_LIBS="$OpenSSL_LIBS"
OPENSSL_CFLAGS="$OpenSSL_CFLAGS"
# Detect the Qt libraries and header
####################################
AC_ARG_WITH([qt],
AS_HELP_STRING([--with-qt], [Select the Qt installation directory]),
[ if test -d "$withval"; then
_QTDIR="$withval"
else
AC_MSG_WARN([Qt directory '$withval' does not exist or is not a directory])
fi
], [_QTDIR="${QTDIR}"])
if test -n "${_QTDIR}" && test -d "${_QTDIR}"; then
_QTDIR=`cd ${_QTDIR} && pwd`
PKG_CONFIG_PATH="${_QTDIR}/lib/pkgconfig:${PKG_CONFIG_PATH}"
LD_LIBRARY_PATH="${_QTDIR}/lib:${LD_LIBRARY_PATH}"
DYLD_LIBRARY_PATH="${_QTDIR}/lib:${DYLD_LIBRARY_PATH}"
fi
AC_ARG_WITH([qt-version],
AS_HELP_STRING([--with-qt-version], [Select the Qt version]),
[WANT_QT_VERSION="$withval"],
[WANT_QT_VERSION=detect])
if test "${WANT_QT_VERSION}" = detect -o "${WANT_QT_VERSION}" = 5; then
PKG_CHECK_MODULES(Qt5, [Qt5Core >= 5.0 Qt5Widgets >= 5.0 Qt5Sql >= 5.0], [
_QT_HOST_BINS="`pkg-config --variable=host_bins Qt5Core`"
QT_MOC="${_QT_HOST_BINS}/moc"
QT_UIC="${_QT_HOST_BINS}/uic"
if test -n "$DARWIN"; then
FRAMEDIR=`pkg-config --variable=libdir Qt5Core`
Qt5_CFLAGS="$Qt5_CFLAGS -std=c++11 -F${FRAMEDIR} -I${FRAMEDIR}/QtCore.framework/Headers -I${FRAMEDIR}/QtGui.framework/Headers -I${FRAMEDIR}/QtWdgets.framework/Headers -I${FRAMEDIR}/QtSql.framework/Headers -Xlinker -rpath -Xlinker ${FRAMEDIR}"
fi
WANT_QT_VERSION=5
QT_VERSION=5
QT_CFLAGS="${Qt5_CFLAGS} -fPIC"
QT_LIBS="${Qt5_LIBS}"
],[ : ])
fi
if test "${WANT_QT_VERSION}" = detect -o "${WANT_QT_VERSION}" = 4; then
PKG_CHECK_MODULES(Qt4, [QtCore >= 4.7 QtCore < 5.0 QtGui >= 4.7 QtGui < 5.0 QtSql >= 4.7 QtSql < 5.0], [
QT_MOC="`pkg-config --variable=moc_location QtCore`"
QT_UIC="`pkg-config --variable=uic_location QtCore`"
if test -n "${QT_MOC}"; then
_QT_HOST_BINS="`dirname ${QT_MOC}`"
fi
if test -n "$DARWIN"; then
FRAMEDIR=`pkg-config --variable=libdir QtCore`
Qt4_CFLAGS="$Qt4_CFLAGS -F${FRAMEDIR} -I${FRAMEDIR}/QtCore.framework/Headers -I${FRAMEDIR}/QtGui.framework/Headers -I${FRAMEDIR}/QtSql.framework/Headers -Xlinker -rpath -Xlinker ${FRAMEDIR}"
fi
WANT_QT_VERSION=4
QT_VERSION=4
QT_CFLAGS="${Qt4_CFLAGS}"
QT_LIBS="${Qt4_LIBS}"
],[ : ])
fi
if test -z "${QT_VERSION}"; then
if test -z "$DARWIN"; then
QT_LIBS=" -lQtCore -lQtGui "
else
_QT_HOST_BINS="${_QTDIR}/bin"
QT_MOC="${_QT_HOST_BINS}/moc"
QT_UIC="${_QT_HOST_BINS}/uic"
FRAMEDIR=${_QTDIR}/lib
QT_LIBS=" -framework QtGui -framework QtCore -framework QtWidgets -framework QtSql -Xlinker -rpath -Xlinker ${FRAMEDIR}"
QT_CFLAGS="-std=c++11 -F${FRAMEDIR} -I${FRAMEDIR}/QtCore.framework/Headers -I${FRAMEDIR}/QtGui.framework/Headers -I${FRAMEDIR}/QtCore.framework/Headers -I${FRAMEDIR}/QtWidgets.framework/Headers -I${FRAMEDIR}/QtSql.framework/Headers"
fi
AC_MSG_WARN([Qt pkg-config failed, using fallback defaults (${QT_LIBS})]);
fi
AC_SUBST([QT_CFLAGS])
AC_SUBST([QT_LIBS])
# Setup MOC UIC RCC LRELEASE LCONVERT with absolute PATH
if test "x${QT_MOC}" = "x"; then
QT_MOC="`which moc-qt${QT_VERSION} || which moc`"
fi
if test "x${QT_UIC}" = "x"; then
QT_UIC="`which uic-qt${QT_VERSION} || which uic`"
fi
QT_BIN_PATH="${_QT_HOST_BINS}:$PATH"
AC_PATH_PROG([QT_LRELEASEQT], [lrelease-qt${QT_VERSION}], , [$QT_BIN_PATH])
if test "x${QT_LRELEASEQT}" = "x"; then
AC_PATH_PROG([QT_LRELEASE], [lrelease], [lrelease], [$QT_BIN_PATH])
else
QT_LRELEASE="$QT_LRELEASEQT"
fi
AC_PATH_PROG([QT_LCONVERTQT], [lconvert-qt${QT_VERSION}], , [$QT_BIN_PATH])
if test "x${QT_LCONVERTQT}" = "x"; then
AC_PATH_PROG([QT_LCONVERT], [lconvert], [lconvert], [$QT_BIN_PATH])
else
QT_LCONVERT="$QT_LCONVERTQT"
fi
AC_PATH_PROG([QT_RCCQT], [rcc-qt${QT_VERSION}], , [$QT_BIN_PATH])
if test "x${QT_RCCQT}" = "x"; then
AC_PATH_PROG([QT_RCC], [rcc], [rcc], [$QT_BIN_PATH])
else
QT_RCC="$QT_RCCQT"
fi
if test -n "$DARWIN"; then
AC_PATH_PROG([MACDEPLOYQT], [macdeployqt], [macdeployqt], [$QT_BIN_PATH])
fi
AC_SUBST([QT_MOC])
AC_SUBST([QT_UIC])
AC_SUBST([QT_LRELEASE])
AC_SUBST([QT_LCONVERT])
AC_SUBST([QT_RCC])
# The dyn_loader library libltdl
##################################
AC_CHECK_LIB(ltdl, lt_dlopen, , [
echo "ERROR: Library 'ltdl' with symbol 'lt_dlopen' not found."
echo " Try installing the package 'libltdl-dev' or 'libtool'"
exit 1
])
AC_CHECK_HEADER(ltdl.h, , [
echo "ERROR: Header 'ltdl.h' not found."
echo " Try installing the package 'libltdl-dev' or 'libtool'"
exit 1
])
# Finally collect the compiler flags
#####################################
CXXFLAGS="${CXXFLAGS} ${OPENSSL_CFLAGS} ${QT_CFLAGS}"
LIBS="${LIBS} ${OPENSSL_LIBS} ${QT_LIBS} -lstdc++"
# Just give it a try .....
##########################
XCA_COMPILE_TEST()
AX_CHECK_GNU_MAKE()
# linuxdoc application detection
##################################
AC_ARG_ENABLE([doc],
AS_HELP_STRING([--disable-doc], [Disable documentation installation]),
,
[enable_doc=yes])
test "${enable_doc}" = "yes" && ENABLE_DOC= || ENABLE_DOC='\#'
AC_SUBST([ENABLE_DOC])
if test "${enable_doc}"; then
AC_CHECK_PROGS([DOCTOOL], [linuxdoc sgml2html], [":"])
AC_SUBST([DOCTOOL])
case "$DOCTOOL" in
linuxdoc) DOCTOOL="linuxdoc -B html -H \$(TOPDIR)/doc/html.header";;
sgml2html) DOCTOOL="sgml2html -s 1 -H \$(TOPDIR)/doc/html.header";;
:)
if test "${srcdir}" != "."; then
mkdir -p doc
cp ${srcdir}/doc/xca-doc.tgz doc/
fi
AC_MSG_WARN(['linuxdoc' or 'sgml2html' not found, using pre-compiled documentation])
;;
esac
fi
# Setup done. Write local.h and Local.mak
############################################
AC_CONFIG_HEADERS(local.h)
AC_CONFIG_LINKS(Makefile:Makefile)
AC_OUTPUT([Local.mak])
AC_OUTPUT([misc/Info.plist])