GCCPY:
[official-gcc.git] / libgpython / configure.ac
blob60526080b1d8dddf2703eba88d16577e2eaa8ec6
1 #   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
2 #   2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
3 #   Free Software Foundation, Inc.
5 # This file is free software; you can redistribute it and/or modify it
6 # under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 3 of the License, or
8 # (at your option) any later version.
10 # This program is distributed in the hope that it will be useful, but
11 # WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13 # General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program; see the file COPYING3.  If not see
17 # <http://www.gnu.org/licenses/>.
19 ##############################################################################
20 ### WARNING: this file contains embedded tabs.  Do not run untabify on this file.
21 # Process this file with autoconf to produce a configure script, like so:
22 # aclocal && autoconf && autoheader && automake
24 AC_PREREQ(2.64)
25 AC_INIT(gccpy-runtime, 0.1, http://gcc.gnu.org, libgpython,
26                        https://github.com/redbrain/gccpy)
27 AC_CONFIG_SRCDIR(Makefile.am)
28 AC_CONFIG_HEADER(config.h)
30 libtool_VERSION=1:0:0
31 AC_SUBST(libtool_VERSION)
33 AC_CANONICAL_SYSTEM
34 target_alias=${target_alias-$host_alias}
37 AM_INIT_AUTOMAKE([1.9.3 no-define foreign no-dist -Wall -Wno-portability])
38 AH_TEMPLATE(PACKAGE, [Name of package])
39 AH_TEMPLATE(VERSION, [Version number of package])
41 m4_rename([_AC_ARG_VAR_PRECIOUS],[glibgpython_PRECIOUS])
42 m4_define([_AC_ARG_VAR_PRECIOUS],[])
43 AC_PROG_CC
44 m4_rename_force([glibgpython_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
46 AC_SUBST(CFLAGS)
48 AM_MAINTAINER_MODE
50 AC_PROG_LD
51 AC_CHECK_TOOL(OBJCOPY, objcopy, missing-objcopy)
53 AC_LIBTOOL_DLOPEN
54 AM_PROG_LIBTOOL
55 AC_SUBST(enable_shared)
56 AC_SUBST(enable_static)
58 CC_FOR_BUILD=${CC_FOR_BUILD:-gcc}
59 AC_SUBST(CC_FOR_BUILD)
61 AC_PROG_AWK
63 WARN_FLAGS='-Wall -Wextra -Wwrite-strings -Wcast-qual'
64 AC_SUBST(WARN_FLAGS)
66 dnl FIXME: This should be controlled by --enable-maintainer-mode.
67 WERROR="-Werror"
68 AC_SUBST(WERROR)
70 # See if the user wants to configure without libffi.  Some
71 # architectures don't support it.  FIXME: We should set a default
72 # based on the host.
73 AC_ARG_WITH(libffi,
74   AS_HELP_STRING([--without-libffi],
75                  [don't use libffi]),
76   [:],
77   [with_libffi=${with_libffi_default-yes}])
79 LIBFFI=
80 LIBFFIINCS=
81 if test "$with_libffi" != no; then
82    AC_DEFINE(USE_LIBFFI, 1, [Define if we're to use libffi.])
83    LIBFFI=../libffi/libffi_convenience.la
84    LIBFFIINCS='-I$(top_srcdir)/../libffi/include -I../libffi/include'
86 AC_SUBST(LIBFFI)
87 AC_SUBST(LIBFFIINCS)
89 dnl Test for the -lm library.
90 MATH_LIBS=
91 AC_CHECK_LIB([m], [sqrt], MATH_LIBS=-lm)
92 AC_SUBST(MATH_LIBS)
94 dnl Test whether the compiler supports the -pthread option.
95 AC_CACHE_CHECK([whether -pthread is supported],
96 [libgpython_cv_lib_pthread],
97 [CFLAGS_hold=$CFLAGS
98 CFLAGS="$CFLAGS -pthread"
99 AC_COMPILE_IFELSE([[int i;]],
100 [libgpython_cv_lib_pthread=yes],
101 [libgpython_cv_lib_pthread=no])
102 CFLAGS=$CFLAGS_hold])
103 PTHREAD_CFLAGS=
104 if test "$libgpython_cv_lib_pthread" = yes; then
105   PTHREAD_CFLAGS=-pthread
107 AC_SUBST(PTHREAD_CFLAGS)
109 dnl Test for the -lpthread library.
110 PTHREAD_LIBS=
111 AC_CHECK_LIB([pthread], [pthread_create], PTHREAD_LIBS=-lpthread)
112 AC_SUBST(PTHREAD_LIBS)
114 AC_C_BIGENDIAN
116 GCC_CHECK_UNWIND_GETIPINFO
118 AC_SUBST(CFLAGS)
119 AC_SUBST(LDFLAGS)
121 # Checks for header files.
122 AC_HEADER_STDBOOL
123 AC_HEADER_STDC
124 AC_CHECK_HEADERS([stdlib.h string.h stdarg.h unistd.h \
125               stdint.h stdio.h getopt.h \
126               assert.h sys/types.h signal.h \
127               fcntl.h pthread.h sys/wait.h])
129 # Checks for typedefs, structures, and compiler characteristics.
130 AC_C_CONST
131 AC_TYPE_PID_T
132 AC_TYPE_SIZE_T
133 AC_CHECK_FUNCS([popen fopen fclose sprintf fprintf strdup \
134                       strlen strcpy strcmp getopt_long \
135                       memcpy calloc system sysconf atoi \
136                       getpid execl fork wait exit atof \
137                       vfprintf memcmp getc fgets pipe \
138                       waitpid fdopen])
140 # Checks for library functions.
141 AC_FUNC_MALLOC
142 AC_FUNC_UTIME_NULL
143 AC_FUNC_VPRINTF
145 AC_CONFIG_FILES(Makefile)
146 AC_OUTPUT