]> www.ginac.de Git - cln.git/blob - configure.ac
Optional support for configure --with-gmp=GMP-PREFIX.
[cln.git] / configure.ac
1 dnl  AUTOCONF configuration for CLN
2 dnl
3 dnl  configure.ac ---<autoconf>--->> configure
4 dnl
5 dnl  configure    ---<sh>--->> config.status
6 dnl                      --->> include/cln/config.h
7 dnl        cln-config.in --->> cln-config
8 dnl          Makefile.in --->> Makefile
9 dnl      src/Makefile.in --->> src/Makefile
10 dnl
11 dnl  Makefile   ---<make>--->> libcln.a
12 dnl
13 dnl
14 AC_INIT(src/integer/gcd/cl_I_gcd.cc)
15 AC_CONFIG_AUX_DIR(autoconf)
16 AC_CONFIG_HEADER(include/cln/config.h include/cln/version.h src/base/cl_base_config.h src/base/cl_gmpconfig.h src/float/cl_float_config.h src/timing/cl_t_config.h)
17 AC_PROG_MAKE_SET
18 dnl This piece of sed script replaces every line containing '@subdir@'
19 dnl by several consecutive lines, each referencing one subdir.
20 extrasub="$extrasub"'
21 /@subdir@/{
22 h
23 g
24 s/@subdir@/src/
25 p
26 g
27 s/@subdir@/tests/
28 p
29 g
30 s/@subdir@/benchmarks/
31 p
32 g
33 s/@subdir@/examples/
34 p
35 g
36 s/@subdir@/doc/
37 p
38 d
39 }
40 '
41 dnl
42 dnl           checks for programs
43 dnl
44 CL_PROG_CC
45                       dnl sets variable CC
46 AC_PROG_CPP
47                       dnl sets variable CPP
48 CL_PROG_CXX
49                       dnl sets variable CXX
50 AC_PROG_CXXCPP
51                       dnl sets variable CXXCPP
52 CL_AS_UNDERSCORE
53                       dnl sets variable AS_UNDERSCORE, DEFS ASM_UNDERSCORE
54 CL_AS_NOEXECSTACK
55                       dnl sets variable ASMFLAGS
56 AC_PROG_RANLIB
57                       dnl sets variable RANLIB
58 AC_PROG_INSTALL
59                       dnl sets variables INSTALL, INSTALL_DATA, INSTALL_PROGRAM
60 dnl
61 dnl           check for host type
62 dnl
63 CL_CANONICAL_HOST(autoconf)
64                       dnl sets variables host, host_cpu, host_vendor, host_os
65 CL_CANONICAL_HOST_CPU
66                       dnl DEFS __${host_cpu}__
67 dnl
68 dnl           check for build configuration
69 dnl
70 PACKAGE=cln
71                       dnl libtool wants PACKAGE
72 case $host_os in
73     *mingw*)
74      AC_DISABLE_SHARED
75   dnl Shared libraries are not supported on some platforms [yet]
76     ;;
77     *)
78      AC_ENABLE_SHARED
79     ;;
80 esac
81 AC_PROG_LIBTOOL
82                       dnl sets variable LIBTOOL
83
84 dnl Libtool's library version information for CLN.
85 dnl (Not to be confused with CLN's release version.)
86 dnl Making new releases:
87 dnl * increment CL_REVISION,
88 dnl * if any functions/classes have been added, removed or changed, increment
89 dnl   CL_CURRENT and set CL_REVISION to 0,
90 dnl * if any functions/classes have been added, increment CL_AGE,
91 dnl * if backwards compatibility has been broken, set CL_AGE to 0.
92 dnl $(CL_CURRENT):$(CL_REVISION):$(CL_AGE) results in
93 dnl libcln.so.$(CL_CURRENT)-$(CL_AGE)
94 CL_CURRENT=5
95 CL_REVISION=1
96 CL_AGE=0
97 dnl make substitutions
98 AC_SUBST(CL_CURRENT)
99 AC_SUBST(CL_REVISION)
100 AC_SUBST(CL_AGE)
101 dnl release version
102 CL_VERSION_MAJOR=1
103 CL_VERSION_MINOR=2
104 CL_VERSION_PATCHLEVEL=1
105 dnl release version for cln/config.h, so it can be tested by the preprocessor
106 AC_DEFINE_UNQUOTED(CL_VERSION_MAJOR, $CL_VERSION_MAJOR)
107 AC_DEFINE_UNQUOTED(CL_VERSION_MINOR, $CL_VERSION_MINOR)
108 AC_DEFINE_UNQUOTED(CL_VERSION_PATCHLEVEL, $CL_VERSION_PATCHLEVEL)
109 dnl concatenated release version
110 CL_VERSION=$CL_VERSION_MAJOR.$CL_VERSION_MINOR.$CL_VERSION_PATCHLEVEL
111 AC_DEFINE_UNQUOTED(CL_VERSION, $CL_VERSION)
112 AC_SUBST(CL_VERSION)
113
114 dnl
115 dnl           checks for compiler characteristics
116 dnl
117 AC_LANG_CPLUSPLUS
118 dnl
119 CL_LONGLONG
120                       dnl DEFS HAVE_LONGLONG
121 CL_LONGDOUBLE
122                       dnl DEFS HAVE_LONGDOUBLE
123 CL_GLOBAL_CONSTRUCTORS
124                       dnl DEFS CL_GLOBAL_CONSTRUCTOR_PREFIX, CL_GLOBAL_DESTRUCTOR_PREFIX
125 dnl
126 dnl           checks for header files
127 dnl
128 AC_CHECK_HEADERS([unistd.h])
129                       dnl DEFS HAVE_UNISTD_H if exist unistd.h
130 dnl
131 dnl           checks for typedefs
132 dnl
133 dnl
134 dnl           checks for functions and declarations
135 dnl
136 CL_ALLOCA
137                       dnl set variable ALLOCA, DEFS NO_ALLOCA
138 CL_FPU_CONTROL
139                       dnl DEFS HAVE_FPU_CONTROL_T, HAVE_SETFPUCW
140 CL_GETTIMEOFDAY
141                       dnl DEFS HAVE_GETTIMEOFDAY, GETTIMEOFDAY_DOTS, GETTIMEOFDAY_TZP_T
142 ac_cv_func_ftime=no
143                       dnl don't use ftime(3) even if it's available
144 CL_TIMES_CLOCK
145                       dnl DEFS HAVE_TIMES_CLOCK
146 CL_RUSAGE
147                       dnl DEFS HAVE_SYS_RESOURCE_H, HAVE_GETRUSAGE, HAVE_SYS_TIMES_H
148 CL_PERROR
149                       dnl DEFS HAVE_PERROR_DECL
150 CL_ATTRIBUTE_FLATTEN
151                       dnl DEFS CL_HAVE_ATTRIBUTE_FLATTEN
152 dnl
153 dnl           checks for compiler characteristics
154 dnl
155 AC_C_CHAR_UNSIGNED
156                       dnl DEFS __CHAR_UNSIGNED__ if char is unsigned
157 CL_MACHINE([integer types and behaviour],${srcdir}/autoconf/intparam.c,[CL_INTPARAM_CROSS],include/cln/intparam.h,cl_cv_file_intparam_h)
158                       dnl builds include/cln/intparam.h
159 CL_MACHINE([floating-point types and behaviour],${srcdir}/autoconf/floatparam.c,[CL_FLOATPARAM_CROSS],include/cln/floatparam.h,cl_cv_file_floatparam_h)
160                       dnl builds include/cln/floatparam.h
161 CL_LIBGMP
162                       dnl DEFS CL_USE_GMP, GMP_DEMANDS_UINTD_*
163 dnl
164 dnl           That's it.
165 dnl
166 for f in 'tests/.gdbinit'; do
167   if test '!' -f "$f"; then
168     echo "creating $f"
169 changequote(,)dnl
170     g=`echo "$f" | sed -e 's,/[^/]*$,,'`
171 changequote([,])dnl
172     test "$g" = "$f" || test -d "$g" || mkdir "$g"
173     cp "$srcdir/$f" "$f"
174   fi
175 done
176 AC_OUTPUT([Makefile src/Makefile tests/Makefile benchmarks/Makefile examples/Makefile doc/Makefile cln.spec cln.pc])