5 AC_CONFIG_SRCDIR([Makefile.in])
6 AC_CONFIG_HEADER(config.h)
12 # ===========================================================================
17 AC_CHECK_PROG(AUTOCONF, autoconf, autoconf, :)
18 AC_CHECK_PROG(STRIP, strip, strip, :)
19 AC_CHECK_PROG(AS, as, as, :)
20 AC_CHECK_PROG(CP, cp, cp, :)
25 # Checking for header files.
26 # ===========================================================================
27 AC_CHECK_HEADERS(unistd.h sys/wait.h)
29 AC_CHECK_HEADERS(sys/socket.h, socket_type=sys_socket_h)
30 if test $socket_type = unknown; then
31 AC_CHECK_HEADERS(winsock2.h, socket_type=winsock2_h)
34 # Checking for functions/libs
35 # ===========================================================================
36 if test $socket_type = winsock2_h; then
39 AC_CHECK_LIB(socket,socket)
40 AC_CHECK_LIB(nsl,xdr_short)
45 # ===========================================================================
47 # Check whether the compiler for the current language is SunPRO.
49 AC_DEFUN([bor_IS_SUNPRO],
50 [AC_CACHE_CHECK([whether we are using the SunPRO _AC_LANG compiler],
51 [bor_cv_[]_AC_LANG_ABBREV[]_compiler_sunpro],
52 [_AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[#if !defined __SUNPRO_C && !defined __SUNPRO_CC
56 [bor_compiler_sunpro=yes],
57 [bor_compiler_sunpro=no])
58 bor_cv_[]_AC_LANG_ABBREV[]_compiler_sunpro=$bor_compiler_sunpro
61 # bor_IS_VALID_OPTION macro checks if the current compiler, selected by
62 # AC_LANG, supports option specified as the 1st parameter. The test fails if
63 # the compiler returns an error or in case something is writeen to stderr.
64 # For example: bor_VALID_OPT(fPIC)
66 AC_DEFUN([bor_IS_VALID_OPTION],
67 [ac_test_[]_AC_LANG_PREFIX[]FLAGS=${[]_AC_LANG_PREFIX[]FLAGS+set}
68 bor_save_[]_AC_LANG_PREFIX[]FLAGS=$[]_AC_LANG_PREFIX[]FLAGS
69 AC_CACHE_CHECK(whether $_AC_LANG_PREFIX accepts -$1, bor_cv_[]_AC_LANG_ABBREV[]_$1,
70 [bor_save_[]_AC_LANG_ABBREV[]_werror_flag=$ac_[]_AC_LANG_ABBREV[]_werror_flag
71 ac_[]_AC_LANG_ABBREV[]_werror_flag=yes
73 []_AC_LANG_PREFIX[]FLAGS="-$1"
74 AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
75 [bor_cv_[]_AC_LANG_ABBREV[]_$1=yes],
76 [bor_cv_[]_AC_LANG_ABBREV[]_$1=no])
77 ac_[]_AC_LANG_ABBREV[]_werror_flag=$bor_save_[]_AC_LANG_ABBREV[]_werror_flag])
78 []_AC_LANG_PREFIX[]FLAGS=$bor_save_[]_AC_LANG_PREFIX[]FLAGS
81 # This macro expands DIR and assigns it to RET.
82 # If DIR is NONE, then it's replaced by DEFAULT.
84 # Based on AC_DEFINE_DIR
88 # adl_EXPAND(prefix, "/usr/local", expanded_prefix)
90 AC_DEFUN([adl_EXPAND], [
91 test "x$prefix" = xNONE && prefix="$ac_default_prefix"
92 test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
94 test "x$ac_expand" = xNONE && ac_expand="[$]$2"
95 ac_expand=`eval echo [$]ac_expand`
96 $3=`eval echo [$]ac_expand`
101 # - empty paths are changed to '.'
102 # - trailing slashes are removed
103 # - repeated slashes are squeezed except a leading doubled slash '//'
104 # (which might indicate a networked disk on some OS).
107 # REFERENCE_STRING is used to turn '/' into '\' and vice-versa: if
108 # REFERENCE_STRING contains some backslashes, all slashes and backslashes
109 # are turned into backslashes, otherwise they are all turned into slashes.
111 # This makes processing of DOS filenames quite easier, because you can turn a
112 # filename to the Unix notation, make your processing, and turn it back to
115 dnl Available from the GNU Autoconf Macro Archive at:
116 dnl http://www.gnu.org/software/ac-archive/htmldoc/normpath.html
118 AC_DEFUN([adl_NORMALIZE_PATH],
120 dnl change empty paths to '.'
122 dnl strip trailing slashes
123 :*[[\\/]]:) $1=`echo "[$]$1" | sed 's,[[\\/]]*[$],,'` ;;
126 dnl squeze repeated slashes
127 case ifelse($2,,"[$]$1",$2) in
128 dnl if the path contains any backslashes, turn slashes into backslashes
130 dnl Bernhard Held 2003-04-06
131 dnl This was the original line. It does not:
132 dnl - convert the first slash
133 dnl - replace a slash with a double-backslash
134 dnl *\\*) $1=`echo "[$]$1" | sed 's,\(.\)[[\\/]][[\\/]]*,\1\\\\,g'` ;;
135 *\\*) $1=`echo "[$]$1" | sed 's,\(.\)[[\\/]][[\\/]]*,\1\\\\\\\\,g
136 s,^[[\\/]],\\\\\\\\,'` ;;
138 dnl if the path contains slashes, also turn backslashes into slashes
139 *) $1=`echo "[$]$1" | sed 's,\(.\)[[\\/]][[\\/]]*,\1/,g'` ;;
143 dnl adl_NORMALIZE_DEFINE_UNQUOTED(var, DEFINE, REFERENCE_STRING)
144 AC_DEFUN([adl_NORMALIZE_DEFINE_UNQUOTED], [
146 adl_NORMALIZE_PATH([ac_ndu], [$]$3)
147 AC_DEFINE_UNQUOTED($2, "${ac_ndu}", [XXX])
151 # Checking characteristics of compilers and other programs
152 # ===========================================================================
153 if test "$ac_cv_c_compiler_gnu" = "yes"; then
154 AC_CACHE_CHECK(whether preprocessor accepts -MM or -M,sdcc_cv_MM,
155 echo "#include <stdio.h>" >_test_.c
157 $CPP -v -MM _test_.c 1>&5 2>&5
158 if test "$?" = "0"; then
165 # This is the first time when CFLAGS are set/modified!!
166 bor_IS_VALID_OPTION(ggdb)
167 if test "$bor_cv_c_ggdb" = "yes"; then
168 CFLAGS="-ggdb ${CFLAGS}"
171 bor_IS_VALID_OPTION(pipe)
172 if test "$bor_cv_c_pipe" = "yes"; then
173 CFLAGS="-pipe $CFLAGS"
178 MAKEDEP="$CC $sdcc_cv_MM"
181 if test "$bor_cv_c_compiler_sunpro" = "yes"; then
183 CFLAGS="-xO2 ${C99_FLAG} ${CFLAGS}"
185 MAKEDEP="$CC ${C99_FLAG} -xM1"
193 # Try to append a c99 flag
194 # -------------------------------------------------------------------------
196 if test "$ac_cv_prog_cc_c99" != "no"; then
197 CFLAGS="$ac_cv_prog_cc_c99 ${CFLAGS}"
200 # Set standard installation paths
201 # ===========================================================================
203 # In the Makefiles we need paths with '/' as directory separator, even if
204 # crosscompiling for Win32.
205 # And we want to preserve the macros (e.g. ${prefix}) in the Makefiles.
206 # The variables in the Makefiles are replaced by AC_SUBST()
208 # In sdccconf.h the '/' in paths can be replaced by "\\" (normalized), if
210 # The macros are expanded for the header.
211 # The variables in the header are replaced by AC_*DEFINE*()
212 # sdccconf_h_dir_separator contains a backslash.
213 AC_ARG_VAR(sdccconf_h_dir_separator, needed in sdccconf.h: either "/" (default) or "\\")
214 if test "x${sdccconf_h_dir_separator}" = "x"; then
215 sdccconf_h_dir_separator="/"
222 # *nix default: "sdcc/lib"
223 AC_ARG_VAR(lib_dir_suffix, appended to datadir to define SDCC's library root directory)
224 if test "${lib_dir_suffix}" = ""; then
225 lib_dir_suffix="sdcc/lib"
227 AC_SUBST(lib_dir_suffix)
234 AC_DEFINE_UNQUOTED(DIR_SEPARATOR_STRING, "${sdccconf_h_dir_separator}", [XXX])
237 # default: "${prefix}/share"
238 adl_EXPAND(datadir, "NONE", expanded_datadir)
239 adl_NORMALIZE_DEFINE_UNQUOTED(expanded_datadir, DATADIR, sdccconf_h_dir_separator)
242 norm_lib_dir_suffix=${lib_dir_suffix}
243 adl_NORMALIZE_PATH([norm_lib_dir_suffix], [$sdccconf_h_dir_separator])
244 AC_DEFINE_UNQUOTED(LIB_DIR_SUFFIX,
245 DIR_SEPARATOR_STRING "${norm_lib_dir_suffix}", [XXX])
248 # Generating output files
249 # ===========================================================================
250 AC_CONFIG_FILES([Makefile])
253 # End of configure/configure.in