2 # Process this file with autoconf to produce a configure script.
5 AC_INIT([pbc], [0.5.14], [blynn@cs.stanford.edu])
7 AC_CONFIG_HEADERS(config.h)
8 AC_CONFIG_MACRO_DIR([m4])
18 AC_MSG_CHECKING([for a fink installation at $default_fink_path])
19 if test -d $default_fink_path; then
20 AC_MSG_RESULT([found it!])
21 AC_MSG_NOTICE([Adding -I$default_fink_path/include to CPPFLAGS])
22 CPPFLAGS="-I$default_fink_path/include $CPPFLAGS"
23 AC_MSG_NOTICE([Adding -L$default_fink_path/lib to LDFLAGS])
24 LDFLAGS="-L$default_fink_path/lib $LDFLAGS"
27 AC_MSG_NOTICE([You may need to add set CPPFLAGS and LDFLAGS for gmp, etc.])
32 ############################
33 # Configs for Windows DLLs.
34 # Framework for the below was extracted and
35 # modeled after the libgmp configure script.
38 AC_SUBST(LIBPBC_DLL,0)
41 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
42 if test -z "$enable_shared"; then
45 # Don't allow both static and DLL.
46 if test "$enable_shared" != no && test "$enable_static" != no; then
47 AC_MSG_ERROR([cannot build both static and DLL, since gmp.h is different for each.
48 Use "--disable-static --enable-shared" to build just a DLL.])
51 # "-no-undefined" is required when building a DLL, see documentation on
52 # AC_LIBTOOL_WIN32_DLL. Also, -no-undefined needs a version number
53 # or it will complain about not having a nonnegative integer.
54 if test "$enable_shared" = yes; then
55 PBC_LDFLAGS="$PBC_LDFLAGS -no-undefined 0 -Wl,--export-all-symbols"
56 LIBPBC_LDFLAGS="$LIBPBC_LDFLAGS -Wl,--output-def,.libs/libpbc.dll.def"
63 gcc_cflags_optlist="$gcc_cflags_optlist nocygwin"
64 gcc_cflags_nocygwin="-mno-cygwin"
69 AC_SUBST(LIBPBC_LDFLAGS)
70 ############################
72 # Checks for programs.
81 if test "x$LEX" != xflex; then
82 echo "************************"
84 echo "************************"
89 if test "x$YACC" != "xbison -y"; then
90 echo "************************"
91 echo "bison not found"
92 echo "************************"
96 # Checks for libraries.
97 lib_err_msg="add its path to LDFLAGS\nsee ./configure --help"
98 AC_CHECK_LIB( [m], [pow], [],[
99 echo "************************"
100 echo "m library not found"
102 echo "************************"
105 AC_CHECK_LIB( [gmp], [__gmpz_init], [],[
106 echo "************************"
107 echo "gmp library not found"
109 echo "************************"
112 dnl Reset libs because most programs do not need to link against all of these libs.
115 # Checks for header files.
118 AC_CHECK_HEADERS([stdlib.h string.h sys/time.h])
120 # Checks for typedefs, structures, and compiler characteristics.
127 with_enable_optimized="no"
128 AC_ARG_ENABLE( optimized,
129 [AS_HELP_STRING([--enable-optimized],
130 [Enable optimized build])],
131 [with_enable_optimized="$withval"],
132 [with_enable_optimized="no"])
136 AC_ARG_ENABLE( safe-clean,
137 [AS_HELP_STRING([--enable-safe-clean],
138 [When free any PBC element or GMP mpz_t, fill internal memory inside the element by zero])],
143 AC_ARG_ENABLE( debug,
144 [AS_HELP_STRING([--enable-debug],
145 [Add extra debugging information. Forbid compiling optimization.])],
149 CFLAGS="$CFLAGS -Wall -W -Wfloat-equal -Wpointer-arith -Wcast-align -Wstrict-prototypes -Wredundant-decls \
150 -Wendif-labels -Wshadow -pipe -ffast-math -U__STRICT_ANSI__ -std=gnu99"
151 if test "$with_debug" == "y"; then
152 CFLAGS="$CFLAGS -g3 -O0"
153 elif test "$with_enable_optimized" != "no"; then
154 CFLAGS="$CFLAGS -g -O2"
156 CFLAGS="$CFLAGS -fomit-frame-pointer -O3"
159 if test "$with_safe_clean" != "n"; then
160 CFLAGS="$CFLAGS -DSAFE_CLEAN"
163 # Checks for library functions.
166 AC_CHECK_FUNCS([floor gettimeofday memmove memset pow sqrt strchr strdup])
168 AC_CONFIG_FILES([Makefile example/Makefile gen/Makefile])
172 echo "global build variables"
173 echo "-----------------------------------------"
175 echo "host info: $host"
176 echo "optimized build: $with_enable_optimized"
177 echo "compiler (CC): $CC"
178 echo "LDFLAGS: $LDFLAGS"
179 echo "CPPFLAGS: $CPPFLAGS"
180 echo "CFLAGS: $CFLAGS"
182 echo "AM_LFLAGS: $AM_LFLAGS"
183 echo "LFLAGS: $LFLAGS"
185 echo "AM_YFLAGS: $AM_YFLAGS"
186 echo "YFLAGS: $YFLAGS"
187 echo "-----------------------------------------"
190 syscmd(bison -d -b pbc/parser pbc/parser.y)
191 syscmd(flex -o pbc/lex.yy.c --header-file=pbc/lex.yy.h pbc/parser.lex)