diff --git a/build-scripts/configure b/build-scripts/configure index 931fa0319..ab5e71a9d 100755 --- a/build-scripts/configure +++ b/build-scripts/configure @@ -1,15 +1,21 @@ -#!/bin/sh -x +#!/bin/sh -. `dirname "$0"`/functions +. "$(dirname "$0")"/functions . detect-environment . compile-options . version case "$PROJECT" in - community) NOVA=no ;; - nova) NOVA=yes ;; - *) fatal "Unknown project: $PROJECT" ;; + community) + NOVA=no + ;; + nova) + NOVA=yes + ;; + *) + fatal "$(basename "$0"): Unknown project: $PROJECT" + ;; esac @@ -21,119 +27,99 @@ if [ $EMBEDDED_DB = lmdb ] then var_append ARGS "--with-lmdb=$P" fi + +for dep in "pthreads-w32" "ldap" "libxml2" "libyaml" "librsync" "leech" "libacl" "libvirt" "libcurl" +do + case "$DEPS" in + *"$dep"*) + var_append ARGS "--with-$dep=$P" + ;; + *) + var_append ARGS "--without-$dep" + ;; + esac +done + case "$DEPS" in - *pthreads-w32*) var_append ARGS "--with-pthreads=$P" ;; -esac -case "$DEPS" in - *openldap*) var_append ARGS "--with-ldap=$P" ;; - *) var_append ARGS "--without-ldap" ;; -esac -case "$DEPS" in - *libxml2*) var_append ARGS "--with-libxml2=$P" ;; - *) var_append ARGS "--without-libxml2" ;; -esac -case "$DEPS" in - *libyaml*) var_append ARGS "--with-libyaml=$P" ;; - *) var_append ARGS "--without-libyaml" ;; -esac -case "$DEPS" in - *librsync*) var_append ARGS "--with-librsync=$P" ;; - *) var_append ARGS "--without-librsync" ;; -esac -case "$DEPS" in - *leech*) var_append ARGS "--with-leech=$P" ;; - *) var_append ARGS "--without-leech" ;; -esac -case "$DEPS" in - *postgresql*) var_append ARGS "--with-postgresql=$P --without-mysql" ;; - *) var_append ARGS "--without-sql" ;; -esac -case "$DEPS" in - *libacl*) var_append ARGS "--with-libacl=$P" ;; - *) var_append ARGS "--without-libacl" ;; -esac -case "$DEPS" in - *libvirt*) var_append ARGS "--with-libvirt=$P" ;; - *) var_append ARGS "--without-libvirt" ;; -esac -# both libcurl or libcurl-hub are valid -case "$DEPS" in - *libcurl*) var_append ARGS "--with-libcurl=$P" ;; - *) var_append ARGS "--without-libcurl" ;; + *postgresql*) + var_append ARGS "--with-postgresql=$P --without-mysql" + ;; + *) + var_append ARGS "--without-sql" + ;; esac + case "$ROLE" in - hub) var_append ARGS "--with-cfmod --with-enterprise-api --with-postgresql=$P" ;; - agent) var_append ARGS "--without-cfmod --without-postgresql" ;; - *) fatal "Unknown ROLE: $ROLE" ;; + hub) + var_append ARGS "--with-cfmod --with-enterprise-api --with-postgresql=$P" + ;; + agent) + var_append ARGS "--without-cfmod --without-postgresql" + ;; + *) + fatal "$(basename "$0"): Unknown ROLE: $ROLE" + ;; esac + case "$WITH_SYSTEMD" in - yes) var_append ARGS "--with-systemd-service" ;; - *) var_append ARGS "--without-systemd-service" ;; + yes) + var_append ARGS "--with-systemd-service" + ;; + *) + var_append ARGS "--without-systemd-service" + ;; esac # RHEL 8 requires an SELinux policy -if [ "x$OS" = "xrhel" ] && [ "${VER%\.*}" -gt "7" ]; then +if [ "$OS" = rhel ] && [ "${VER%\.*}" -gt "7" ]; then var_append ARGS "--with-selinux-policy" fi # Cross-compiling Windows? case "$ARCH-${OS_FAMILY}" in - x86-mingw) var_append ARGS "--host=i686-w64-mingw32" ;; - x64-mingw) var_append ARGS "--host=x86_64-w64-mingw32" ;; + x86-mingw) + var_append ARGS "--host=i686-w64-mingw32" + ;; + x64-mingw) + var_append ARGS "--host=x86_64-w64-mingw32" + ;; esac case "$BUILD_TYPE" in - - RELEASE) - CFLAGS="-g2 -O2 -DNDEBUG $CFLAGS" - ;; - DEBUG) - ARGS="$ARGS --enable-debug" - # Override the default "-g3 -O0" that comes with ./configure --enable-debug - # in order to reduce the size of the packages - CFLAGS="-g2 -O1 $CFLAGS" - ;; - CODE_COVERAGE) - ARGS="$ARGS --enable-debug" - # lcov is not found in Windows and other platforms - case "${OS}-${OS_VERSION}" in - mingw*) + RELEASE) + CFLAGS="-g2 -O2 -DNDEBUG $CFLAGS" + ;; + DEBUG) + ARGS="$ARGS --enable-debug" + # Override the default "-g3 -O0" that comes with ./configure --enable-debug + # in order to reduce the size of the packages + CFLAGS="-g2 -O1 $CFLAGS" + ;; + *) + echo "$(basename "$0"): Error: Unknown build type: $BUILD_TYPE" + exit 42 ;; - hpux*) - ;; - solaris*) - ;; - rhel-4.*) - ;; - aix*) - ;; - *) - ARGS="$ARGS --enable-coverage" - ;; - esac - ;; - *) - echo "Unknown build type: $BUILD_TYPE" - exit 42 - ;; esac -if [ "x$OS" = "xsolaris" ] +if [ "$OS" = solaris ] then export PKG_CONFIG_PATH="$BUILDPREFIX/lib/pkgconfig" fi +echo "$(basename "$0"): Debug: running configure on core repo..." +( cd "$BASEDIR"/core && env "$OPTS" CFLAGS="$CFLAGS" run_and_print_on_failure ./configure "$ARGS" ) -( cd $BASEDIR/core && env $OPTS CFLAGS="$CFLAGS" ./configure $ARGS ) - -if [ "x$NOVA" = "xyes" ] +if [ "$NOVA" = yes ] then - ( cd $BASEDIR/enterprise && env $OPTS CFLAGS="$CFLAGS" ./configure $ARGS ) - if [ "x$ROLE" = "xhub" ] + echo "$(basename "$0"): Debug: running configure on enterprise repo..." + ( cd "$BASEDIR"/enterprise && env "$OPTS" CFLAGS="$CFLAGS" run_and_print_on_failure ./configure "$ARGS" ) + if [ "$ROLE" = hub ] then - ( cd $BASEDIR/nova && env $OPTS CFLAGS="$CFLAGS" ./configure $ARGS ) + echo "$(basename "$0"): Debug: running configure on hub repo..." + ( cd "$BASEDIR"/nova && env "$OPTS" CFLAGS="$CFLAGS" run_and_print_on_failure ./configure "$ARGS" ) fi fi -( cd $BASEDIR/masterfiles && env $OPTS CFLAGS="$CFLAGS" ./configure $ARGS ) +echo "$(basename "$0"): Debug: running configure on masterfiles repo..." +( cd "$BASEDIR"/masterfiles && env "$OPTS" CFLAGS="$CFLAGS" run_and_print_on_failure ./configure "$ARGS" )