File: configure

package info (click to toggle)
mpqc3 0.0~git20170114-4.1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 148,800 kB
  • sloc: cpp: 545,687; ansic: 13,220; perl: 5,065; fortran: 1,990; lisp: 1,269; python: 717; yacc: 392; sh: 304; f90: 238; lex: 184; xml: 182; makefile: 114
file content (175 lines) | stat: -rwxr-xr-x 5,890 bytes parent folder | download | duplicates (2)
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
#!/bin/sh

TOPDIR=$(cd `dirname $0` && pwd)
#echo $TOPDIR

# Strip prefix from argument
arg () {
  echo "$1" | sed "s/^${2-[^=]*=}//"
}

# Display CMake bootstrap usage
help()
{
echo '
Configure MPQC. This script will invoke cmake.
Alternatively, use cmake or ccmake directly.

Invoked as "configure cmake" it will download and install cmake into ./cmake directory 

Usage: '"$0"' [<options>...]
Options: [defaults in brackets after descriptions]
Configuration:
  --help                  print this message
  --new-features          MPQC new features (-DMPQC_NEW_FEATURES=TRUE)
  --debug                 debug build (CMAKE_BUILD_TYPE=Debug)
  --shared                build as shared libs (BUILD_SHARED_LIBS=ON)
  --prefix=               install prefix (CMAKE_INSTALL_PREFIX=)
  --lapack=               LAPACK libraries (LAPACK_LIBRARIES=)
  --integer8              assume integer*8 in fortran
  --mpicc=                MPI C compiler used to deduce MPI environment (MPI_C_COMPILER=)
                          WARNING: This does not set CC or CXX, set those explicitly
  --libint=               TRUE/FALSE or installed Libint prefix path
  --boost=                Boost path
  --unittest              Will build the boost unit testing library. Requires 
                          boost be built by MPQC. (MPQC_UNITTEST=FALSE)
  --search=               paths to search for files/libraries, separated by semicolon
                          (CMAKE_PREFIX_PATH=)
  --expert                Expert mode: disables building dependencies (MPQC_EXPERT=TRUE)
  --openmp                Enable OpenMP (MPQC_OPENMP=TRUE)
  --python                Enable Python bindings; uses default python executable ('env python')
                          if want specific executable, set cmake variable PYTHON_EXECUTABLE
  --ci=                   Enable/disable CI
  -D*                     defines cmake variables, passed verbatim to cmake command

Environment variables:
  CC          C compiler command       (e.g. CC='mpicc')
  CFLAGS      C compiler flags         (e.g. CFLAGS='-O0 -g -std=c11')
  CXX         C++ compiler command     (e.g. CXX='mpicxx')
  CXXFLAGS    C++ compiler flags       (e.g. CXXFLAGS='-O0 -g -std=c++0x')
  CPPFLAGS    C/C++ proprocessor flags (e.g. CPPFLAGS='-I/opt/local/include -DNDEBUG')
  F77         Fortran 77 compiler command  (e.g. F77='gfortran')
  FFLAGS      Fortran 77 compiler flags    (e.g. FFLAGS='-fdefault-integer-8')
  LDFLAGS     linker flags             (e.g. LDFLAGS=-L/libdir)
  CMAKE       cmake command to use     (e.g. CMAKE='/opt/local/bin/cmake')

MPQC-specific cmake variables:
  INTEGRALLIBINT2_NORMCONV          Normalization convention of IntegralLibint2, 1(cca; default) or 2(exact)
  DEFAULT_MPQC_MEMORY               Limit for how much memory to use by default, in bytes (default=536870912).
'
  exit 10
}

# was told to build local cmake
if [ $# -eq 1 -a "$1" = "cmake" ]; then
    cd $TOPDIR/cmake && make cmake
    exit
fi

# use user-provided CMAKE
if [ ! -x "$CMAKE" ]; then
    # look for locally-built cmake
    if [ -x $TOPDIR/cmake/bin/cmake ]; then
        CMAKE=$TOPDIR/cmake/bin/cmake
    # else look for system cmake
    else
        CMAKE=`which cmake 2>/dev/null`
	if [ ! -x "$CMAKE" ]; then
	    echo 'cmake is not found; try building cmake by typing: ./configure cmake'
	    exit 11
	fi	
    fi
fi

srcdir=`dirname $0`
args=""
prefix=$PWD
build="Release"

# log the command-line args, preserving quotes
log="#!/bin/sh\n# Last invoked on `date`:\n$0 "
for token in "$@"
  do
    log="$log '$token'"
  done
  
while test $# != 0; do
  case "$1" in
  --help|-h|-help) help ;;
  --prefix=*)      prefix="`arg \"$1\"`" ;;
  --new-features)  args="$args -DMPQC_NEW_FEATURES=TRUE" ;;
  --lapack=*)      lapack="`arg \"$1\"`"
                   args="$args -DLAPACK_LIBRARIES=\"$lapack\"" ;;
  --integer8)      args="$args -DINTEGER8=TRUE" ;;
  --debug)         build="Debug" ;; #args="$args -DCMAKE_BUILD_TYPE=Debug" ;;
  --shared)        args="$args -DBUILD_SHARED_LIBS=ON" ;;
  --search=*)      search="`arg \"$1\"`"
		   args="$args -DCMAKE_PREFIX_PATH=\"$search\"" ;;
  --libint=*)      libint="`arg \"$1\"`"
                   args="$args -DLIBINT=\"$libint\"" ;;
  --mpicc=*)       args="$args -DMPI_C_COMPILER=`arg \"$1\"`" ;;
  --boost=*)       args="$args -DBOOST=`arg \"$1\"`" ;;
  --unittest)      args="$args -DMPQC_UNITTEST=TRUE" ;;
  --expert)        args="$args -DMPQC_EXPERT=TRUE" ;;
  --openmp)        args="$args -DMPQC_OPENMP=TRUE" ;;
  --python)        args="$args -DPYTHON=TRUE" ;;
  --ci=*)          args="$args -DMPQC_CI=`arg \"$1\"`" ;;
  -D*) args="$args \"$1\"" ;; # raw  cmake arg
  CC=*) CC="`arg \"$1\"`" ;;
  CXX=*) CXX="`arg \"$1\"`" ;;
  F77=*) F77="`arg \"$1\"`" ;;
  CPPFLAGS=*) CPPFLAGS="`arg \"$1\"`" ;;
  CFLAGS=*) CFLAGS="`arg \"$1\"`" ;;
  CXXFLAGS=*) CXXFLAGS="`arg \"$1\"`" ;;
  FFLAGS=*) FFLAGS="`arg \"$1\"`" ;;
  LDFLAGS=*) LDFLAGS="`arg \"$1\"`" ;;
  *) exit "Unknown option: \"$1\"" ;;
  esac
  shift
done

# dump command-line arguments into reconf.sh
echo $log > reconf.sh
chmod +x reconf.sh

args="$args -DCMAKE_INSTALL_PREFIX=$prefix"
args="$args -DCMAKE_BUILD_TYPE=$build"

if [ -n "$CC" ]; then
    args="$args -DCMAKE_C_COMPILER=$CC"
fi

if [ -n "$CXX" ]; then
    args="$args -DCMAKE_CXX_COMPILER=$CXX"
fi

if [ -n "$F77" ]; then
    args="$args -DCMAKE_Fortran_COMPILER=$F77"
fi

if [ -n "$CPPFLAGS" ]; then
    args="$args -DCMAKE_CPP_FLAGS=\"$CPPFLAGS\""
fi

if [ -n "$CFLAGS" ]; then
    args="$args -DCMAKE_C_FLAGS=\"$CFLAGS\""
fi

if [ -n "$CXXFLAGS" ]; then
    args="$args -DCMAKE_CXX_FLAGS=\"$CXXFLAGS\""
fi

if [ -n "$FFLAGS" ]; then
    args="$args -DCMAKE_Fortran_FLAGS=\"$FFLAGS\""
fi

if [ -n "$LDFLAGS" ]; then
    args="$args -DCMAKE_EXE_LINKER_FLAGS=\"$LDFLAGS\""
fi

echo "Using CMake $CMAKE"
cmd="$CMAKE $args $srcdir"

set -x
rm -fr CMakeFiles CMakeCache.txt
eval $cmd