source: pcp/configure.ac@ 5fd79e

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

configure BUGFIX: GSL may be linked against cblas_... functions or just ..., this is fixed.

Before we checked for cblas_dnrm2. However, e.g. libgoto names it simply dnrm2. Hence, the blas functions are not found or slower (c)blas, or gsl(c)blas is used. Now, we simply check for dnrm2 functions in the list of libs first, if it fails, then for cblas_dnrm2. And finally, we test GSL functionality by checking for main(), which only works if a working blas lib has been found before.
Also, we removed AC_MSG_NOTICE about CFLAGS and others. However, the other for MPICC was left present.

  • Property mode set to 100644
File size: 7.0 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
14if test x"$CFLAGS" = x; then
15 CFLAGS_empty=1
16else
17 CFLAGS_empty=0
18fi
19if test x"$CXXFLAGS" = x; then
20 CXXFLAGS_empty=1
21else
22 CXXFLAGS_empty=0
23fi
24
25# Checks for programs.
26AC_PROG_CC
27AC_PROG_CXX
28AC_PATH_PROG([PERL],[perl])
29AC_PATH_PROG([TAR],[tar])
30AM_MISSING_PROG([DOXYGEN], [doxygen])
31
32# Resetting C(XX)FLAGS again
33if test $CFLAGS_empty -eq 1; then
34 CFLAGS=""
35fi
36if test $CXXFLAGS_empty -eq 1; then
37 CXXFLAGS=""
38fi
39
40
41dnl Check for MPI-Routines
42AC_ARG_VAR(MPICC, [contains mpi C compiler])
43AC_ARG_VAR(MPICXX, [contains mpi C++ compiler])
44AC_ARG_VAR(MPILIBS, [contains mpi libraries used when linking])
45AC_ARG_ENABLE([mpi],
46 AC_HELP_STRING([--enable-mpi],
47 [build MPI parallel version
48 (default is yes if MPI code can be compiled)]),
49 [enable_mpi=$enableval], [enable_mpi=maybe])
50disabled_msg="MPI version disabled."
51if test x"$enable_mpi" = xyes -o x"$enable_mpi" = xmaybe
52then
53 AC_MSG_NOTICE([checking for MPI features])
54 ACX_MPI([enable_mpi=yes],
55 [err_msg="cannot find out how to compile MPI code."
56 if test x"$enable_mpi" = xyes
57 then
58 AC_MSG_ERROR([$err_msg])
59 else
60 AC_MSG_WARN([$err_msg $disabled_msg])
61 enable_mpi=no
62 fi])
63 if test x"$enable_mpi" = xyes; then
64 AC_ARG_VAR([MPILIBS],[necessary libraries to link MPI C code])
65 AC_ARG_VAR([MPICC],[necessary comnpiler for MPI C code])
66 AC_ARG_VAR([MPICXX],[necessary comnpiler for MPI CPP code])
67 #AM_CONDITIONAL([MPIVER], [test x"$enable_mpi" = xyes])
68 AC_MSG_NOTICE(["MPICC: $MPICC, MPILIBS: $MPILIBS, MPIVER: $MPIVER, CC: $CC"])
69 # if CC not set, set to MPICC
70 if ! test x"$MPICC" = x; then
71 CC="$MPICC"
72 fi
73 if ! test x"$MPICXX" = x; then
74 CXX="$MPICXX"
75 else
76 CXX="$MPICC"
77 fi
78 if ! test x"$MPILIBS" = x; then
79 LDFLAGS="$LDFLAGS $MPILIBS"
80 #AC_CHECK_LIB(mpich, MPI_Allreduce, ,AC_MSG_ERROR([compatible mpich library not found]))
81 fi
82 fi
83else
84 AC_MSG_NOTICE([$disabled_msg])
85fi
86
87AC_ARG_ENABLE([debug],AS_HELP_STRING([--enable-debug],[debugging level of compiler. Argument is yes or debugging level. (default is no)]),
88 [enable_debugging=$enableval], [enable_debugging=no])
89AC_ARG_ENABLE([optimization],AS_HELP_STRING([--enable-optimization],[Optimization level of compiler. Argument is yes or optimization. (default is 2)]),
90 [enable_optimization=$enableval], [enable_optimization=2])
91AC_ARG_ENABLE([warnings], AS_HELP_STRING([--enable-warnings],[Output compiler warnings, argument is none, some or full (default is some).]),
92 [enable_warnings=$enableval], [enable_warnings=some])
93AC_SET_COMPILER_FLAGS([$enable_optimization], [$enable_debugging], [$enable_warnings])
94
95# Checks for typedefs, structures, and compiler characteristics.
96AC_TYPE_PID_T
97AC_TYPE_SIZE_T
98AC_TYPE_SIGNAL
99
100AC_C_CONST
101AC_C_INLINE
102AC_C_VOLATILE
103AC_C_RESTRICT
104
105# Checks for library functions.
106# 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.])])
107AC_FUNC_MALLOC
108AC_FUNC_REALLOC
109AC_TYPE_SIGNAL
110
111# Checks for fftw libraries and find out version.
112AC_CHECK_LIB(m, sqrt, ,AC_MSG_ERROR([compatible libc math library not found]))
113AC_CHECK_FUNCS([alarm atexit floor pow sqrt strchr uname strstr strrchr])
114FFTW=notfound
115RFFTW=notfound
116AC_ARG_ENABLE([fftw],
117 AS_HELP_STRING([--enable-fftw],[build FFTW-2 version (default is yes if fftw2 code can be compiled)]),
118 [enable_fftw=$enableval], [enable_fftw=maybe])
119AC_ARG_ENABLE([dfftw],
120 AS_HELP_STRING([--enable-dfftw],[build double fftw2 version (default is fftw2)]),
121 [enable_dfftw=$enableval], [enable_dfftw=maybe])
122AC_ARG_ENABLE([fftw3],
123 AS_HELP_STRING([--enable-fftw3],[build FFTW-3 version (default is fftw2)]),
124 [enable_fftw3=$enableval], [enable_fftw3=maybe])
125
126# Checks for header files.
127AC_HEADER_STDC
128AC_CHECK_HEADERS([sys/time.h unistd.h float.h stddef.h])
129AC_HEADER_STDBOOL
130
131# check for fftw headers and subsequently for libs
132# if FFTW=.. set on success condition, -l... is not appended
133# .._HEADER doesn't show up in configh.h, .._HEADERS does!
134FFTW=notfound
135if test x"$FFTW" = xnotfound -o x"$enable_fftw" = xyes; then
136 FFTW=FFTW
137 AC_CHECK_HEADERS(fftw.h,
138 [AC_CHECK_LIB(fftw, fftw_create_plan, , [FFTW=notfound], -lfftw)],
139 [FFTW=notfound]
140 )
141
142 AC_CHECK_HEADERS(rfftw.h,
143 [AC_CHECK_LIB(rfftw, rfftw_create_plan, , [FFTW=notfound],-lrfftw)],
144 [FFTW=notfound]
145 )
146fi
147if test x"$FFTW" = xnotfound -o x"$enable_dfftw" = xyes; then
148 FFTW=DFFTW
149 AC_CHECK_HEADERS(dfftw.h,
150 [AC_CHECK_LIB(dfftw, fftw_create_plan, , [FFTW=notfound],-ldfftw)],
151 [FFTW=notfound]
152 )
153
154 AC_CHECK_HEADERS(drfftw.h,
155 [AC_CHECK_LIB(drfftw, rfftw_create_plan, , [FFTW=notfound],-ldrfftw)],
156 [FFTW=notfound]
157 )
158fi
159if test x"$FFTW" = xnotfound -o x"$enable_fftw3" = xyes; then
160 FFTW=FFTW3
161 AC_CHECK_HEADERS(fftw3.h,
162 [AC_CHECK_LIB(fftw3, fftw_create_plan, , [FFTW=notfound],-lfftw3)],
163 [FFTW=notfound]
164 )
165fi
166# warn if not found
167if test x"$FFTW" = xnotfound; then
168 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.."])
169 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.."])
170fi
171# check for GNU Scientific Library
172#AC_CHECK_LIB(m,main)
173AC_CHECK_HEADERS([gsl/gsl_blas.h])
174AC_SEARCH_LIBS(dnrm2, goto blas cblas gslblas gslcblas)
175AC_CHECK_LIB(gsl, main, [],
176 [AC_SEARCH_LIBS(cblas_dnrm2, blas cblas gslblas gslcblas)])
177AC_CHECK_LIB(gsl, gsl_blas_dnrm2, , [AC_MSG_ERROR(["No working BLAS found for GSL, stopping."])])
178
179dnl Check for "extern inline", using a modified version
180dnl of the test for AC_C_INLINE from acspecific.mt
181dnl
182AC_CACHE_CHECK([for extern inline], ac_cv_c_extern_inline,
183[ac_cv_c_extern_inline=no
184AC_TRY_COMPILE([extern $ac_cv_c_inline double foo(double x);
185extern $ac_cv_c_inline double foo(double x) { return x+1.0; };
186double foo (double x) { return x + 1.0; };],
187[ foo(1.0) ],
188[ac_cv_c_extern_inline="yes"])
189])
190
191if test "$ac_cv_c_inline" != no ; then
192 AC_DEFINE(HAVE_INLINE,1, ["May use inline routines"])
193 AC_SUBST(HAVE_INLINE)
194fi
195
196#AC_MSG_NOTICE(["CFLAGS: $CFLAGS, CXXFLAGS: $CXXFLAGS, LDFLAGS: $LDFLAGS, CC: $CC, CXX:, $CXX, MPICC: $MPICC, MPILIBS: $MPILIBS, LIBS: $LIBS"])
197
198# test suite
199AC_CONFIG_TESTDIR(tests)
200AC_CONFIG_FILES([tests/atlocal tests/Makefile])
201AC_CONFIG_FILES([tests/pcp], [chmod +x tests/pcp])
202
203AC_CONFIG_FILES([Makefile src/Makefile doc/Makefile])
204AC_OUTPUT
Note: See TracBrowser for help on using the repository browser.