3 GLOBAL_ERROR_INDICATOR=0
5 check_for_application()
9 which "$PROG" >/dev/null 2>&1
10 if test $? -ne 0; then
12 WARNING: \`$PROG' not found!
13 Please make sure that \`$PROG' is installed and is in one of the
14 directories listed in the PATH environment variable.
16 GLOBAL_ERROR_INDICATOR=1
24 libtoolize --version >/dev/null 2>/dev/null
25 if test $? -eq 0; then
28 glibtoolize --version >/dev/null 2>/dev/null
29 if test $? -eq 0; then
30 libtoolize=glibtoolize
33 WARNING: Neither \`libtoolize' nor \`glibtoolize' have been found!
34 Please make sure that one of them is installed and is in one of the
35 directories listed in the PATH environment variable.
37 GLOBAL_ERROR_INDICATOR=1
41 if test "$GLOBAL_ERROR_INDICATOR" != "0"; then
49 check_for_application lex bison autoheader aclocal automake autoconf pkg-config
55 && $libtoolize --copy --force \
56 && automake --add-missing --copy \
62 echo "Building for Cygwin..."
63 check_for_application aclocal autoconf autoheader automake bison flex git make pkg-config x86_64-w64-mingw32-gcc
68 : ${INSTALL_DIR:="C:/PROGRA~1/collectd"}
69 : ${LIBDIR:="${INSTALL_DIR}"}
70 : ${BINDIR:="${INSTALL_DIR}"}
71 : ${SBINDIR:="${INSTALL_DIR}"}
72 : ${SYSCONFDIR:="${INSTALL_DIR}"}
73 : ${LOCALSTATEDIR:="${INSTALL_DIR}"}
74 : ${DATAROOTDIR:="${INSTALL_DIR}"}
75 : ${DATADIR:="${INSTALL_DIR}"}
77 echo "Installing collectd to ${INSTALL_DIR}."
79 MINGW_ROOT="$(x86_64-w64-mingw32-gcc -print-sysroot)/mingw"
80 export GNULIB_DIR="${TOP_SRCDIR}/gnulib/build/gllib"
82 export CC="x86_64-w64-mingw32-gcc"
84 if [ -d "${TOP_SRCDIR}/gnulib/build" ]; then
85 echo "Assuming that gnulib is already built, because gnulib/build exists."
93 --dir=${TOP_SRCDIR}/gnulib/build \
114 cd ${TOP_SRCDIR}/gnulib/build
115 ./configure --host="mingw32" LIBS="-lws2_32 -lpthread"
119 # We have to rebuild libgnu.a to get the list of *.o files to build a dll later
121 OBJECT_LIST=`make V=1 | grep "ar" | cut -d' ' -f4-`
122 $CC -shared -o libgnu.dll $OBJECT_LIST -lws2_32 -lpthread
123 rm libgnu.a # get rid of it, to use libgnu.dll
130 export LDFLAGS="-L${GNULIB_DIR}"
132 export CFLAGS="-Drestrict=__restrict -I${GNULIB_DIR}"
135 --prefix="${INSTALL_DIR}" \
136 --libdir="${LIBDIR}" \
137 --bindir="${BINDIR}" \
138 --sbindir="${SBINDIR}" \
139 --sysconfdir="${SYSCONFDIR}" \
140 --localstatedir="${LOCALSTATEDIR}" \
141 --datarootdir="${DATAROOTDIR}" \
142 --datarootdir="${DATADIR}" \
143 --disable-all-plugins \
146 --enable-match_regex \
147 --enable-target_replace \
150 cp ${GNULIB_DIR}/../config.h src/gnulib_config.h
151 echo "#include <config.h.in>" >> src/gnulib_config.h
153 cp libtool libtool_bak
154 sed -i "s%\$LTCC \$LTCFLAGS\(.*cwrapper.*\)%\$LTCC \1%" libtool
159 cp "${GNULIB_DIR}/libgnu.dll" "${INSTALL_DIR}"
160 cp "${MINGW_ROOT}/bin/zlib1.dll" "${INSTALL_DIR}"
161 cp "${MINGW_ROOT}/bin/libwinpthread-1.dll" "${INSTALL_DIR}"
162 cp "${MINGW_ROOT}/bin/libdl.dll" "${INSTALL_DIR}"
168 if test "${os_name#CYGWIN}" != "$os_name"; then