forked from PLN-team/PLNmodels
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure
executable file
·59 lines (52 loc) · 1.94 KB
/
configure
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
#!/bin/bash
# Julien Chiquet (2018) mainly stolen from Anticonf scripts by Jeroen Ooms
#
# This script will query 'pkg-config' for the required cflags and ldflags.
#
# 02-05-2018 initial version: only working for linux
PKG_CONFIG_NAME="nlopt"
PKGCONFIG_DEB_NAME="pkg-config"
PKGCONFIG_RPM_NAME="pkgconfig"
PKGCONFIG_BREW_NAME="pkg-config"
PKG_DEB_NAME="libnlopt-dev"
PKG_RPM_NAME="NLopt-devel"
PKG_BREW_NAME="nlopt"
PKG_CSW_NAME=""
PKG_TEST_HEADER="<nlopt.hpp>"
# Use pkg-config if available
pkg-config --version >/dev/null 2>&1
if [ $? -eq 0 ]; then
NLOPT_LIBS=`pkg-config --libs ${PKG_CONFIG_NAME}`
else
echo "------------------------- ANTICONF ERROR ---------------------------"
echo "Configuration failed because pkg-config is not installed. Try installing: "
echo " * deb: sudo apt-get install $PKGCONFIG_DEB_NAME (Debian, Ubuntu)"
echo " * rpm: $PKGCONFIG_RPM_NAME (Fedora, EPEL)"
echo " * brew: brew install $PKGCONFIG_BREW_NAME (MacOS with brew)"
echo " * otherwise: not available"
echo "--------------------------------------------------------------------"
exit 1;
fi
# For debugging
# echo "Using NLOPT_LIBS=$NLOPT_LIBS"
# Test for linblopt
echo "#include $PKG_TEST_HEADER" >/dev/null 2>&1
if [ $? -ne 0 ]; then
echo "------------------------- ANTICONF ERROR ---------------------------"
echo "Configuration failed because $PKG_CONFIG_NAME was not found. Try installing:"
echo " * deb: sudo apt-get install $PKG_DEB_NAME (Debian, Ubuntu)"
echo " * rpm: sudo yum install $PKG_RPM_NAME (Fedora, EPEL)"
echo " * brew: brew install $PKG_RPM_NAME (MacOS with brew)"
echo " * otherwise: not yet available"
echo "--------------------------------------------------------------------"
exit 1;
fi
if [[ "$OSTYPE" == "darwin"* ]]; then
OPENMP_FLAG=''
else
OPENMP_FLAG='$(SHLIB_OPENMP_CXXFLAGS)'
fi
# Write to Makevars
sed -e "s|@nlopt_libs@|$NLOPT_LIBS|" -e "s|@openmp_flag@|$OPENMP_FLAG|" src/Makevars.in > src/Makevars
# Success
exit 0