source: pcp/configure.ac@ 2f6ae6

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

normal blas (e.g. prefered gotoblas) instead of gslcblas is used in linking

  • Property mode set to 100644
File size: 6.1 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 AS_HELP_STRING([--enable-mpi],[build MPI parallel version (default is yes if MPI code can be compiled)]),
24 [enable_mpi=$enableval], [enable_mpi=maybe])
25disabled_msg="MPI version disabled."
26if test x"$enable_mpi" = xyes -o x"$enable_mpi" = xmaybe
27then
28 AC_MSG_NOTICE([checking for MPI features])
29 ACX_MPI([enable_mpi=yes
30 CC=mpicc
31 CXX=mpicxx],
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])
40else
41 AC_MSG_NOTICE([$disabled_msg])
42fi
43#AC_ARG_VAR([MPILIBS],[necessary libraries to link MPI C code])
44AM_CONDITIONAL([MPIVER], [test x"$enable_mpi" = xyes])
45
46# Checks for typedefs, structures, and compiler characteristics.
47AC_TYPE_PID_T
48AC_TYPE_SIZE_T
49AC_TYPE_SIGNAL
50
51AC_C_CONST
52AC_C_INLINE
53AC_C_VOLATILE
54AC_C_RESTRICT
55
56# Checks for library functions.
57# 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.])])
58AC_FUNC_MALLOC
59AC_FUNC_REALLOC
60AC_TYPE_SIGNAL
61
62# Checks for fftw libraries and find out version.
63AC_CHECK_LIB(m, sqrt, ,AC_MSG_ERROR([compatible libc math library not found]))
64AC_CHECK_FUNCS([alarm atexit floor pow sqrt strchr uname strstr strrchr])
65FFTW=notfound
66RFFTW=notfound
67AC_ARG_ENABLE([fftw],
68 AS_HELP_STRING([--enable-fftw],[build FFTW-2 version (default is yes if fftw2 code can be compiled)]),
69 [enable_fftw=$enableval], [enable_fftw=maybe])
70AC_ARG_ENABLE([dfftw],
71 AS_HELP_STRING([--enable-dfftw],[build double fftw2 version (default is fftw2)]),
72 [enable_dfftw=$enableval], [enable_dfftw=maybe])
73AC_ARG_ENABLE([fftw3],
74 AS_HELP_STRING([--enable-fftw3],[build FFTW-3 version (default is fftw2)]),
75 [enable_fftw3=$enableval], [enable_fftw3=maybe])
76
77# debugging info
78AC_ARG_ENABLE([debug],AS_HELP_STRING([--enable-debug],[Output debugging information, argument is yes or debugging level (default is no).]),
79 [enable_debug=$enableval], [enable_debug=no])
80if ! test x"$enable_debug" = xno; then
81 if test x"${enable_debug}" = xyes; then
82 CFLAGS="-g3"
83 CXXFLAGS="-g3"
84 else
85 CFLAGS="-g${enable_debug}"
86 CXXFLAGS="-g${enable_debug}"
87 fi
88 AC_DEFINE(HAVE_DEBUG,1, ["Output debugging info"])
89 AC_SUBST(HAVE_DEBUG)
90fi
91
92# optimization level
93AC_ARG_ENABLE([optimization],AS_HELP_STRING([--enable-optimization],[Optimization level of compiler. Argument is yes or debugging level. (default is 2)]),
94 [enable_optimization=$enableval], [enable_optimization=yes])
95if test ! x"$enable_optimization" = xno; then
96 if test x"$enable_debug" = xno; then
97 if test x"${enable_optimization}" = xyes; then
98 CFLAGS="-O2"
99 CXXFLAGS="-O2"
100 else
101 CFLAGS="-O${enable_optimization}"
102 CXXFLAGS="-O${enable_optimization}"
103 fi
104# else
105# AC_MSG_WARN(["Already specified --enable-debug!"])
106 fi
107fi
108
109# Checks for header files.
110AC_HEADER_STDC
111AC_CHECK_HEADERS([sys/time.h unistd.h float.h stddef.h])
112AC_HEADER_STDBOOL
113
114# check for fftw headers and subsequently for libs
115# if FFTW=.. set on success condition, -l... is not appended
116# .._HEADER doesn't show up in configh.h, .._HEADERS does!
117FFTW=notfound
118if test x"$FFTW" = xnotfound -o x"$enable_fftw" = xyes; then
119 FFTW=FFTW
120 AC_CHECK_HEADERS(fftw.h,
121 [AC_CHECK_LIB(fftw, fftw_create_plan, , [FFTW=notfound], -lfftw)],
122 [FFTW=notfound]
123 )
124
125 AC_CHECK_HEADERS(rfftw.h,
126 [AC_CHECK_LIB(rfftw, rfftw_create_plan, , [FFTW=notfound],-lrfftw)],
127 [FFTW=notfound]
128 )
129fi
130if test x"$FFTW" = xnotfound -o x"$enable_dfftw" = xyes; then
131 FFTW=DFFTW
132 AC_CHECK_HEADERS(dfftw.h,
133 [AC_CHECK_LIB(dfftw, fftw_create_plan, , [FFTW=notfound],-ldfftw)],
134 [FFTW=notfound]
135 )
136
137 AC_CHECK_HEADERS(drfftw.h,
138 [AC_CHECK_LIB(drfftw, rfftw_create_plan, , [FFTW=notfound],-ldrfftw)],
139 [FFTW=notfound]
140 )
141fi
142if test x"$FFTW" = xnotfound -o x"$enable_fftw3" = xyes; then
143 FFTW=FFTW3
144 AC_CHECK_HEADERS(fftw3.h,
145 [AC_CHECK_LIB(fftw3, fftw_create_plan, , [FFTW=notfound],-lfftw3)],
146 [FFTW=notfound]
147 )
148fi
149# warn if not found
150if test x"$FFTW" = xnotfound; then
151 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.."])
152 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.."])
153fi
154# check for GNU Scientific Library
155#AC_CHECK_LIB(m,main)
156AC_CHECK_LIB(blas,main)
157AC_CHECK_LIB(gsl,main)
158
159dnl Check for "extern inline", using a modified version
160dnl of the test for AC_C_INLINE from acspecific.mt
161dnl
162AC_CACHE_CHECK([for extern inline], ac_cv_c_extern_inline,
163[ac_cv_c_extern_inline=no
164AC_TRY_COMPILE([extern $ac_cv_c_inline double foo(double x);
165extern $ac_cv_c_inline double foo(double x) { return x+1.0; };
166double foo (double x) { return x + 1.0; };],
167[ foo(1.0) ],
168[ac_cv_c_extern_inline="yes"])
169])
170
171if test "$ac_cv_c_inline" != no ; then
172 AC_DEFINE(HAVE_INLINE,1, ["May use inline routines"])
173 AC_SUBST(HAVE_INLINE)
174fi
175
176# test suite
177#AC_CONFIG_TESTDIR(tests)
178#AC_CONFIG_FILES([tests/m4], [chmod +x tests/m4])
179#AC_CONFIG_FILES([tests/Makefile tests/atlocal])
180
181AC_CONFIG_FILES([Makefile src/Makefile doc/Makefile])
182AC_OUTPUT
Note: See TracBrowser for help on using the repository browser.