File: configure.in

package info (click to toggle)
polylib 5.22.5-3%2Bdfsg
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd, stretch, wheezy
  • size: 14,444 kB
  • ctags: 52,958
  • sloc: ansic: 16,342; sh: 10,134; makefile: 560
file content (289 lines) | stat: -rw-r--r-- 8,713 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
dnl	This file is an input file used by the GNU "autoconf" program to
dnl	generate the file "configure", which is run to configure the
dnl	Makefile in this directory.

#    This file is part of PolyLib.                                                         
#
#    PolyLib is free software: you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation, either version 3 of the License, or   
#    (at your option) any later version.                                 
#
#    PolyLib is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
#    GNU General Public License for more details.                  
#
#    You should have received a copy of the GNU General Public License
#    along with PolyLib.  If not, see <http://www.gnu.org/licenses/>.

# Authors: Bart Kienhuis, Vincent Loechner, T. Risset
# Copyright (c) 2000 The Regents of the University of California.
# All rights reserved.
# 
# Permission is hereby granted, without written agreement and without
# license or royalty fees, to use, copy, modify, and distribute this
# software and its documentation for any purpose, provided that the
# above copyright notice and the following two paragraphs appear in all
# copies of this software.
# 
# IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
# FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
# ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
# THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
# 
# THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
# PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF
# CALIFORNIA HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES,
# ENHANCEMENTS, OR MODIFICATIONS.
# 
# 						PT_COPYRIGHT_VERSION_2
# 						COPYRIGHTENDKEY

dnl Process this file with autoconf to produce a configure script.

AC_INIT(polylib, 5.22.5)
AM_INIT_AUTOMAKE([gnu])
AC_CONFIG_SRCDIR(include/polylib/polylib.h.in)
AC_CONFIG_MACRO_DIR([m4])

AC_PREREQ(2.60)

AC_SUBST(versioninfo)
versioninfo=9:0:1

if test "x$prefix" != "xNONE"; then
    prefix_wd=`cd $prefix && pwd`
    srcdir_wd=`cd $srcdir && pwd`
    wd=`pwd`
    if test "x$prefix_wd" = "x$srcdir_wd"; then
	AC_MSG_ERROR(Installation in source directory not supported)
    fi
    if test "x$prefix_wd" = "x$wd"; then
	AC_MSG_ERROR(Installation in build directory not supported)
    fi
fi

dnl Checks for programs.
AC_PROG_CC
AC_PROG_LN_S
AC_PROG_INSTALL
AC_PROG_LIBTOOL
AM_PROG_CC_C_O

dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST

dnl Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS(limits.h unistd.h)
AC_CHECK_HEADERS(getopt.h)


dnl /*****************************************************************************/
dnl See if the only goal is to create an 'int', 'longint', or 'longlongint' library

AC_CHECK_SIZEOF(int,1)
AC_CHECK_SIZEOF(long int,1)
AC_CHECK_SIZEOF(long long int,1)

AC_SUBST(polylib32_defs)
AC_SUBST(polylib64_defs)
AC_SUBST(polylib128_defs)

for type in long_long_int long_int int; do
    case "$type" in
	int)
	    bits=`expr $ac_cv_sizeof_int \* 8`
	    defs="#define LINEAR_VALUE_IS_INT"
	    ;;
	long_int)
	    bits=`expr $ac_cv_sizeof_long_int \* 8`
	    defs="#define LINEAR_VALUE_IS_LONG
#define LINEAR_VALUE_PROTECT_MULTIPLY"
	    ;;
	long_long_int)
	    bits=`expr $ac_cv_sizeof_long_long_int \* 8`
	    defs="#define LINEAR_VALUE_IS_LONGLONG
#define LINEAR_VALUE_PROTECT_MULTIPLY
#define LINEAR_VALUE_ASSUME_SOFTWARE_IDIV"
	    ;;
    esac
    case "$bits" in
	32)
	    polylib32_defs=$defs
	    ;;
	64)
	    polylib64_defs=$defs
	    ;;
	128)
	    polylib128_defs=$defs
	    ;;
    esac
done


AC_SUBST(polylibs)
AC_SUBST(ALL_BITS)

AC_ARG_ENABLE(int-lib,
	[  --enable-int-lib        Build an int library], 
        [lib_type=int
	 bits=`expr $ac_cv_sizeof_int \* 8`
	 polylibs="libpolylib$bits.la $polylibs"
	 ALL_BITS="$bits $ALL_BITS"
	])
AC_ARG_ENABLE(longint-lib,
	[  --enable-longint-lib    Build a long int library], 
        [lib_type=longint
	 bits=`expr $ac_cv_sizeof_long_int \* 8`
	 polylibs="libpolylib$bits.la $polylibs"
	 ALL_BITS="$bits $ALL_BITS"
	])
AC_ARG_ENABLE(longlongint-lib,
	[  --enable-longlongint-lib Build a long long int library], 
        [lib_type=longlongint
	 bits=`expr $ac_cv_sizeof_long_long_int \* 8`
	 polylibs="libpolylib$bits.la $polylibs"
	 ALL_BITS="$bits $ALL_BITS"
	])

dnl Check for GMP library
AC_MSG_CHECKING(whether to use GMP)
AC_ARG_WITH(libgmp, 
        [  --with-libgmp           DIR Location of the GMP Distribution], 
	gmp_package=$withval, gmp_package=no)
if test "x$gmp_package" = "xno"; then
	AC_MSG_RESULT(no)
else
	AC_MSG_RESULT(yes)
	if test "x$gmp_package" != "xyes"; then
	    GMP_DIR=$gmp_package
	    if test ! -d "$GMP_DIR"; then
	    	AC_ERROR(Directory given for GMP Distribution is not a directory)
	    fi
	    CPPFLAGS="-I$GMP_DIR/include $CPPFLAGS"
	    LDFLAGS="-L$GMP_DIR/lib $LDFLAGS"
	fi
	AC_CHECK_HEADER(gmp.h,
		[AC_CHECK_LIB(gmp,main,
		    [poly_cv_gmpfatal="no"],
		    [poly_cv_gmpfatal="yes"])],
		[poly_cv_gmpfatal="yes"])
	if test "$poly_cv_gmpfatal" = "yes"; then
		AC_MSG_ERROR([GMP not found])
	else
		AC_CHECK_DECLS(mp_get_memory_functions,[],[
			AC_LIBOBJ(mp_get_memory_functions)
		],[#include <gmp.h>])
	fi

	lib_type=gmp
	BITS=`expr gmp`
	LIBS="-lgmp $LIBS"
	polylibs="libpolylib$BITS.la $polylibs"
	ALL_BITS="$BITS $ALL_BITS"
fi

if test "X$lib_type" = "X"; then
    AC_MSG_CHECKING(what the LONG representation is)
    if test "$ac_cv_sizeof_long_long_int" -gt "$ac_cv_sizeof_int"; then
	AC_MSG_RESULT([long long int])
	lib_type=longlongint
	bits=`expr $ac_cv_sizeof_long_long_int \* 8`
	polylibs="libpolylib$bits.la $polylibs"
	ALL_BITS="$bits $ALL_BITS"
    elif test "$ac_cv_sizeof_long_int" -gt "$ac_cv_sizeof_int"; then
	AC_MSG_RESULT([long int])
	lib_type=longint
	bits=`expr $ac_cv_sizeof_long_int \* 8`
	polylibs="libpolylib$bits.la $polylibs"
	ALL_BITS="$bits $ALL_BITS"
    else
	AC_MSG_RESULT([NONE!])
	lib_type=int
	bits=`expr $ac_cv_sizeof_int \* 8`
	polylibs="libpolylib$bits.la $polylibs"
	ALL_BITS="$bits $ALL_BITS"
    fi
fi

case "$lib_type" in
	int)
	    BITS=`expr $ac_cv_sizeof_int \* 8`
	    ;;
	longint)
	    BITS=`expr $ac_cv_sizeof_long_int \* 8`
	    ;;
	longlongint)
	    BITS=`expr $ac_cv_sizeof_long_long_int \* 8`
	    ;;
esac


AC_SUBST(polylib)
polylib="libpolylib$BITS.la"

dnl extra indirection to avoid automake getting confused
AC_SUBST(multi_bin_programs)
AC_SUBST(multi_noinst_programs)
for pl_bit in $ALL_BITS ; do
	multi_bin_programs="$multi_bin_programs \$(multi_bin_programs_${pl_bit})"
	multi_noinst_programs="$multi_noinst_programs \$(no_inst_programs_${pl_bit})"
done

dnl /*****************************************************************************/
AC_ARG_ENABLE(extra-suffix,
	[  --enable-extra-suffix   Add bits size suffix to executables],
	[ if test "$enableval" = yes; then
		program_transform_name="s/\$\$/$BITS/;$program_transform_name"
    fi ] )

dnl /********************************************************************/
dnl Check for DOXYGEN package
AC_ARG_WITH(doxygen, [  --with-doxygen          DIR Location of the Doxygen Distribution (http://www.doxygen.org)], doxygen_package=$withval)

dnl AC_MSG_CHECKING(for Doxygen program)
AC_CHECK_PROG(DOXYGEN,doxygen,doxygen,test,[$PATH:$doxygen_package/bin:/usr/local/bin])
dnl AC_MSG_RESULT($DOXYGEN)


AC_SUBST(LIBS)

dnl long/int bits and compilation flags
AC_SUBST(BITS)

dnl Used with doxygen
AC_SUBST(DOXYGEN)

dnl Currently, we only create one .pc file
dnl Creating one for each configured version is a bit complicated
PACKAGE_NAME=polylib$BITS
AX_CREATE_PKGCONFIG_INFO

AC_CONFIG_HEADERS(config.h)
AC_OUTPUT(Makefile
	  include/Makefile
	  include/polylib/Makefile
	  include/polylib/polylib.h
	  Test/Makefile
	  Test/Zpolytest/Makefile
	  Test/ehrhart/Makefile
	  Test/ehrhart_union/Makefile
	  Test/ranking/Makefile
	  Test/general/Makefile
	  Test/pp/Makefile
	  polylib.doxygen
	)


echo "Polylib will be built with " $ALL_BITS "integer size(s)"
echo "---------------------------------------------------"
echo "You can proceed with:"
echo "make               :to build the libs and the executables"
echo "make tests         :to test the library"
echo "make install       :to install them (to $prefix)"
echo "---------------------------------------------------"