source: pcp/configure.ac@ 2f6525

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

new MPI autoconf macro installed and changed lines in configure.ac

MPICC was set to CC which caused trouble, when different gcc version had to be used (core2 optimization). As standard mpicc is just a link to gcc with mpi headers included, in the new manner, this can easily be acounted for

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