Skip to content

Commit

Permalink
fixes #752 configure script could be more robust
Browse files Browse the repository at this point in the history
  • Loading branch information
gdamore committed Jun 3, 2016
1 parent c8b55a6 commit 1ebe8db
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 15 deletions.
13 changes: 7 additions & 6 deletions CMakeLists.txt
Expand Up @@ -163,13 +163,14 @@ if (WIN32)
set(NN_REQUIRED_LIBRARIES ${NN_REQUIRED_LIBRARIES} ws2_32)
set(NN_REQUIRED_LIBRARIES ${NN_REQUIRED_LIBRARIES} mswsock)
set(NN_REQUIRED_LIBRARIES ${NN_REQUIRED_LIBRARIES} advapi32)
nn_check_func (InitializeConditionVariable NN_HAVE_CONDVAR)
nn_check_sym (InitializeConditionVariable windows.h NN_HAVE_CONDVAR)
if (NOT NN_HAVE_CONDVAR)
message (ERROR "Modern Windows API support is missing.")
message (ERROR "Versions of Windows prior to Vista are not supported.")
message (ERROR "Further, the 32-bit MinGW environment is not supported.")
message (ERROR "Ensure you have at least Windows Vista or newer, and are")
message (ERROR "using either Visual Studio 2010 or newer or MinGW-W64.")
message (FATAL_ERROR
"Modern Windows API support is missing. "
"Versions of Windows prior to Vista are not supported. "
"Further, the 32-bit MinGW environment is not supported. "
"Ensure you have at least Windows Vista or newer, and are "
"using either Visual Studio 2010 or newer or MinGW-W64.")
endif()
else ()
# Unconditionally declare the following feature test macros. These are
Expand Down
24 changes: 15 additions & 9 deletions configure
Expand Up @@ -29,21 +29,26 @@ CURDIR=`pwd`

strip_arg()
{
echo "$1" | sed "s/[^=]*=//"
x=`echo "$1" | sed "s/[^=]*=//"`
eval $2=\"$x\"
}

warn() {
echo "$*" 2>&1
echo "$*" 1>&2
}

find_prog() {
for p in `echo "$PATH" | sed 's/:/ /'`; do
SIFS="${IFS= }"
IFS=:
for p in $PATH; do
if [ -x ${p}/$1 ]
then
IFS="${SIFS}"
echo "${p}/${1}"
return 0
fi
done
IFS="${SIFS}"
return 1
}

Expand All @@ -68,24 +73,25 @@ help() {
exit 1
}

CMAKE_ARGS=()
# Argument parsing
#
while [ -n "$1" ]; do
case "$1" in
--with-cmake)
CMAKE="$2"
shift 2
;;
--with-cmake=*)
CMAKE=`strip_arg "$1"`
strip_arg "$1" CMAKE
shift
;;
--prefix)
PREFIX="-DCMAKE_INSTALL_PREFIX=$2"
CMAKE_ARGS+=( "-DCMAKE_INSTALL_PREFIX=$2" )
shift 2
;;
--prefix=*)
PREFIX=-DCMAKE_INSTALL_PREFIX=`strip_arg "$1"`
strip_arg "$1" PFX
CMAKE_ARGS+=( "-DCMAKE_INSTALL_PREFIX=$PFX" )
shift
;;
*)
Expand All @@ -100,9 +106,9 @@ fi

if [ -f src/nn.h ]
then
warn "NB: In-tree building is not recommended."
warn "NOTE: Building in the source directory is not recommended."
fi

GENERATOR="Unix Makefiles"

$CMAKE $PREFIX -G "$GENERATOR" $SRCDIR
"$CMAKE" "${CMAKE_ARGS[@]}" -G "$GENERATOR" $SRCDIR

0 comments on commit 1ebe8db

Please sign in to comment.