1dnl   Copyright (C) 2014-2022 Free Software Foundation, Inc.
2dnl
3dnl This file is part of GCC.
4dnl
5dnl GCC is free software; you can redistribute it and/or modify it under
6dnl the terms of the GNU General Public License as published by the Free
7dnl Software Foundation; either version 3, or (at your option) any later
8dnl version.
9dnl
10dnl GCC is distributed in the hope that it will be useful, but WITHOUT ANY
11dnl WARRANTY; without even the implied warranty of MERCHANTABILITY or
12dnl FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
13dnl for more details.
14dnl
15dnl You should have received a copy of the GNU General Public License
16dnl along with GCC; see the file COPYING3.  If not see
17dnl <http://www.gnu.org/licenses/>.
18
19AC_INIT([libcc1], [version-unused])
20AC_CONFIG_SRCDIR([libcc1.cc])
21AC_CONFIG_HEADER(cc1plugin-config.h)
22
23AC_CANONICAL_SYSTEM
24AC_USE_SYSTEM_EXTENSIONS
25# Determine the noncanonical target name, for directory use.
26ACX_NONCANONICAL_TARGET
27GCC_TOPLEV_SUBDIRS
28
29# 1.11.1: Require that version of automake.
30# foreign: Don't require README, INSTALL, NEWS, etc.
31# no-define: Don't define PACKAGE and VERSION.
32# -Wall: Issue all automake warnings.
33# -Wno-portability: Don't warn about constructs supported by GNU make.
34#    (because GCC requires GNU make anyhow).
35AM_INIT_AUTOMAKE([1.11.1 foreign no-dist no-define -Wall -Wno-portability])
36AM_MAINTAINER_MODE
37
38LT_INIT([disable-static])
39AM_PROG_LIBTOOL
40AC_PROG_CXX
41
42visibility=
43if test "$GXX" = yes; then
44  visibility=-fvisibility=hidden
45fi
46AC_SUBST(visibility)
47
48GCC_CET_HOST_FLAGS(CET_HOST_FLAGS)
49AC_SUBST(CET_HOST_FLAGS)
50
51AC_CHECK_DECLS([basename])
52
53GCC_BASE_VER
54
55if test x$with_gcc_major_version_only = xyes ; then
56  changequote(,)dnl
57  gcc_version=`sed -e 's/^\([0-9]*\).*$/\1/' $srcdir/../gcc/BASE-VER`
58  changequote([,])dnl
59else
60  gcc_version=`cat $srcdir/../gcc/BASE-VER`
61fi
62AC_SUBST(gcc_version)
63AC_SUBST([CONFIG_STATUS_DEPENDENCIES], ['$(top_srcdir)/../gcc/BASE-VER'])
64
65ACX_PROG_CC_WARNING_OPTS([-W -Wall], [WARN_FLAGS])
66AC_SUBST(WARN_FLAGS)
67ACX_PROG_CC_WARNINGS_ARE_ERRORS([manual])
68
69AC_ARG_VAR(GMPINC,[How to find GMP include files])
70
71libsuffix=
72if test "$GXX" = yes; then
73  libsuffix=`$CXX -print-multi-os-directory`
74fi
75AC_SUBST(libsuffix)
76
77dnl Test for -lsocket and -lnsl.  Copied from libgo/configure.ac.
78AC_CACHE_CHECK([for socket libraries], libcc1_cv_lib_sockets,
79  [libcc1_cv_lib_sockets=
80   libcc1_check_both=no
81   AC_CHECK_FUNC(connect, libcc1_check_socket=no, libcc1_check_socket=yes)
82   if test "$libcc1_check_socket" = "yes"; then
83     unset ac_cv_func_connect
84     AC_CHECK_LIB(socket, main, libcc1_cv_lib_sockets="-lsocket",
85     		  libcc1_check_both=yes)
86   fi
87   if test "$libcc1_check_both" = "yes"; then
88     libcc1_old_libs=$LIBS
89     LIBS="$LIBS -lsocket -lnsl"
90     unset ac_cv_func_accept
91     AC_CHECK_FUNC(accept,
92		   [libcc1_check_nsl=no
93		    libcc1_cv_lib_sockets="-lsocket -lnsl"])
94     unset ac_cv_func_accept
95     LIBS=$libcc1_old_libs
96   fi
97   unset ac_cv_func_gethostbyname
98   libcc1_old_libs="$LIBS"
99   AC_CHECK_FUNC(gethostbyname, ,
100		 [AC_CHECK_LIB(nsl, main,
101		 	[libcc1_cv_lib_sockets="$libcc1_cv_lib_sockets -lnsl"])])
102   unset ac_cv_func_gethostbyname
103   LIBS=$libcc1_old_libs
104])
105LIBS="$LIBS $libcc1_cv_lib_sockets"
106
107case "$host" in
108  *-*-darwin*) darwin_dynamic_lookup=yes ;;
109  *) darwin_dynamic_lookup=no ;;
110esac
111AM_CONDITIONAL(DARWIN_DYNAMIC_LOOKUP, test $darwin_dynamic_lookup = yes)
112
113# If any of these functions are missing, simply don't bother building
114# this plugin.
115GCC_ENABLE_PLUGINS
116AC_CHECK_FUNC(socketpair, , enable_plugin=no)
117AC_CHECK_FUNC(select, , enable_plugin=no)
118AC_CHECK_FUNC(fork, , enable_plugin=no)
119AM_CONDITIONAL(ENABLE_PLUGIN, test $enable_plugin = yes)
120
121AC_CONFIG_FILES([Makefile])
122AC_OUTPUT
123