source: pcp/configure.ac@ bdba3c

Last change on this file since bdba3c was bdba3c, checked in by Frederik Heber <heber@…>, 17 years ago

AM_CFLAGS thrown out as warnings are added to CFLAGS in configure-part. Huge changes to make mpi working with given environment variables MPICC and MPILIBS

  • Property mode set to 100644
File size: 7.2 KB
Line 
1# -*- Autoconf -*-
2# Process this file with autoconf to produce a configure script.
3
4AC_PREREQ(2.59)
5AC_INIT([ElectronicStructurePACKage], 1.1, heber@ins.uni-bonn.de, ESPACK)
6AC_CONFIG_AUX_DIR([config])
7AC_CONFIG_SRCDIR([src/pcp.c])
8AC_CONFIG_HEADER([config.h])
9
10AM_INIT_AUTOMAKE(dist-bzip2)
11
12AC_CANONICAL_HOST
13
14# Checks for programs.
15AC_PROG_CC
16AC_PROG_CXX
17AC_PATH_PROG([PERL],[perl])
18AC_PATH_PROG([TAR],[tar])
19AM_MISSING_PROG([DOXYGEN], [doxygen])
20
21dnl Check for MPI-Routines
22AC_ARG_ENABLE([mpi],
23 AC_HELP_STRING([--enable-mpi],
24 [build MPI parallel version
25 (default is yes if MPI code can be compiled)]),
26 [enable_mpi=$enableval], [enable_mpi=maybe])
27disabled_msg="MPI version disabled."
28if test x"$enable_mpi" = xyes -o x"$enable_mpi" = xmaybe
29then
30 AC_MSG_NOTICE([checking for MPI features])
31 ACX_MPI([enable_mpi=yes],
32 [err_msg="cannot find out how to compile MPI code."
33 if test x"$enable_mpi" = xyes
34 then
35 AC_MSG_ERROR([$err_msg])
36 else
37 AC_MSG_WARN([$err_msg $disabled_msg])
38 enable_mpi=no
39 fi])
40 if test x"$enable_mpi" = xyes; then
41 AC_ARG_VAR([MPILIBS],[necessary libraries to link MPI C code])
42 AC_ARG_VAR([MPICC],[necessary comnpiler for MPI C code])
43 AC_ARG_VAR([MPICXX],[necessary comnpiler for MPI CPP code])
44 #AM_CONDITIONAL([MPIVER], [test x"$enable_mpi" = xyes])
45 AC_MSG_WARN(["MPICC: $MPICC, MPILIBS: $MPILIBS, MPIVER: $MPIVER, CC: $CC"])
46 # if CC not set, set to MPICC
47 if ! test x"$MPICC" = x; then
48 CC="$MPICC"
49 fi
50 if ! test x"$MPICXX" = x; then
51 CXX="$MPICXX"
52 else
53 CXX="$MPICC"
54 fi
55 if ! test x"$MPILIBS" = x; then
56 LDFLAGS="$LDFLAGS $MPILIBS"
57 AC_CHECK_LIB(mpich, MPI_Allreduce, ,AC_MSG_ERROR([compatible mpich library not found]))
58 fi
59 fi
60else
61 AC_MSG_NOTICE([$disabled_msg])
62fi
63
64# Checks for typedefs, structures, and compiler characteristics.
65AC_TYPE_PID_T
66AC_TYPE_SIZE_T
67AC_TYPE_SIGNAL
68
69AC_C_CONST
70AC_C_INLINE
71AC_C_VOLATILE
72AC_C_RESTRICT
73
74# Checks for library functions.
75# use when adapted: AC_CHECK_FUNCS([floor ftruncate memmove memset mkdir modf pow realpath sqrt strchr strdup strerror strrchr strstr strtol statfs],[],[AC_MSG_WARN([Some functions not found. Compile may fail. Alternate methods may need to be implemented.])])
76AC_FUNC_MALLOC
77AC_FUNC_REALLOC
78AC_TYPE_SIGNAL
79
80# Checks for fftw libraries and find out version.
81AC_CHECK_LIB(m, sqrt, ,AC_MSG_ERROR([compatible libc math library not found]))
82AC_CHECK_FUNCS([alarm atexit floor pow sqrt strchr uname strstr strrchr])
83FFTW=notfound
84RFFTW=notfound
85AC_ARG_ENABLE([fftw],
86 AS_HELP_STRING([--enable-fftw],[build FFTW-2 version (default is yes if fftw2 code can be compiled)]),
87 [enable_fftw=$enableval], [enable_fftw=maybe])
88AC_ARG_ENABLE([dfftw],
89 AS_HELP_STRING([--enable-dfftw],[build double fftw2 version (default is fftw2)]),
90 [enable_dfftw=$enableval], [enable_dfftw=maybe])
91AC_ARG_ENABLE([fftw3],
92 AS_HELP_STRING([--enable-fftw3],[build FFTW-3 version (default is fftw2)]),
93 [enable_fftw3=$enableval], [enable_fftw3=maybe])
94
95# debugging info
96AC_ARG_ENABLE([debug],AS_HELP_STRING([--enable-debug],[Output debugging information, argument is yes or debugging level (default is no).]),
97 [enable_debug=$enableval], [enable_debug=no])
98if ! test x"$enable_debug" = xno; then
99 if test x"${enable_debug}" = xyes; then
100 CFLAGS="$CFLAGS -g3"
101 CXXFLAGS="$CXXFLAGS -g3"
102 else
103 CFLAGS="$CFLAGS -g${enable_debug}"
104 CXXFLAGS="$CXXFLAGS -g${enable_debug}"
105 fi
106 dnl enable all warnings
107 CFLAGS="$CFLAGS -Wall -W -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -Wshadow -Wpointer-arith -Wcast-align -Wcast-qual -Wwrite-strings -Wredundant-decls -Wnested-externs -Wmissing-noreturn -Wformat-security -Wmissing-format-attribute -Winit-self"
108 CXXFLAGS="$CXXFLAGS -Wall -W -Wshadow -Wpointer-arith -Wcast-align -Wcast-qual -Wwrite-strings -Wredundant-decls -Wmissing-noreturn -Wformat-security -Wmissing-format-attribute -Winit-self"
109 AC_DEFINE(HAVE_DEBUG,1, ["Output debugging info"])
110 AC_SUBST(HAVE_DEBUG)
111else
112 dnl even without debugging we want some minimal info of something's utterly wrong
113 CFLAGS="$CFLAGS -Wall"
114 CXXFLAGS="$CXXFLAGS -Wall"
115fi
116
117# optimization level
118AC_ARG_ENABLE([optimization],AS_HELP_STRING([--enable-optimization],[Optimization level of compiler. Argument is yes or debugging level. (default is 2)]),
119 [enable_optimization=$enableval], [enable_optimization=yes])
120if ! test x"$enable_optimization" = xno; then
121 if test x"$enable_debug" = xno; then
122 if test x"${enable_optimization}" = xyes; then
123 CFLAGS="$CFLAGS -O2"
124 CXXFLAGS="$CXXFLAGS -O2"
125 else
126 CFLAGS="$CFLAGS -O${enable_optimization}"
127 CXXFLAGS="$CXXFLAGS -O${enable_optimization}"
128 fi
129 #else
130 #AC_MSG_WARN(["Already specified --enable-debug!"])
131 fi
132fi
133
134# Checks for header files.
135AC_HEADER_STDC
136AC_CHECK_HEADERS([sys/time.h unistd.h float.h stddef.h])
137AC_HEADER_STDBOOL
138
139# check for fftw headers and subsequently for libs
140# if FFTW=.. set on success condition, -l... is not appended
141# .._HEADER doesn't show up in configh.h, .._HEADERS does!
142FFTW=notfound
143if test x"$FFTW" = xnotfound -o x"$enable_fftw" = xyes; then
144 FFTW=FFTW
145 AC_CHECK_HEADERS(fftw.h,
146 [AC_CHECK_LIB(fftw, fftw_create_plan, , [FFTW=notfound], -lfftw)],
147 [FFTW=notfound]
148 )
149
150 AC_CHECK_HEADERS(rfftw.h,
151 [AC_CHECK_LIB(rfftw, rfftw_create_plan, , [FFTW=notfound],-lrfftw)],
152 [FFTW=notfound]
153 )
154fi
155if test x"$FFTW" = xnotfound -o x"$enable_dfftw" = xyes; then
156 FFTW=DFFTW
157 AC_CHECK_HEADERS(dfftw.h,
158 [AC_CHECK_LIB(dfftw, fftw_create_plan, , [FFTW=notfound],-ldfftw)],
159 [FFTW=notfound]
160 )
161
162 AC_CHECK_HEADERS(drfftw.h,
163 [AC_CHECK_LIB(drfftw, rfftw_create_plan, , [FFTW=notfound],-ldrfftw)],
164 [FFTW=notfound]
165 )
166fi
167if test x"$FFTW" = xnotfound -o x"$enable_fftw3" = xyes; then
168 FFTW=FFTW3
169 AC_CHECK_HEADERS(fftw3.h,
170 [AC_CHECK_LIB(fftw3, fftw_create_plan, , [FFTW=notfound],-lfftw3)],
171 [FFTW=notfound]
172 )
173fi
174# warn if not found
175if test x"$FFTW" = xnotfound; then
176 AC_MSG_WARN(["Missing lib(d)fftw(3) and/or lib(d)rfftw(3).\nIf exist but not in LD_.._PATH, use export LDFLAGS=-L.."])
177 AC_MSG_WARN(["Or missing header (d)fftw(3).h and/or (d)rfftw.h\nIf exist but not in PATH, use export CFLAGS=-I.."])
178fi
179# check for GNU Scientific Library
180#AC_CHECK_LIB(m,main)
181AC_CHECK_LIB(blas,main)
182AC_CHECK_LIB(gsl,main)
183
184dnl Check for "extern inline", using a modified version
185dnl of the test for AC_C_INLINE from acspecific.mt
186dnl
187AC_CACHE_CHECK([for extern inline], ac_cv_c_extern_inline,
188[ac_cv_c_extern_inline=no
189AC_TRY_COMPILE([extern $ac_cv_c_inline double foo(double x);
190extern $ac_cv_c_inline double foo(double x) { return x+1.0; };
191double foo (double x) { return x + 1.0; };],
192[ foo(1.0) ],
193[ac_cv_c_extern_inline="yes"])
194])
195
196if test "$ac_cv_c_inline" != no ; then
197 AC_DEFINE(HAVE_INLINE,1, ["May use inline routines"])
198 AC_SUBST(HAVE_INLINE)
199fi
200
201# test suite
202AC_CONFIG_TESTDIR(tests)
203AC_CONFIG_FILES([tests/atlocal tests/Makefile])
204AC_CONFIG_FILES([tests/pcp], [chmod +x tests/pcp])
205
206AC_CONFIG_FILES([Makefile src/Makefile doc/Makefile])
207AC_OUTPUT
Note: See TracBrowser for help on using the repository browser.