#!/bin/sh AC_PREREQ(2.60) AC_INIT AC_CONFIG_SRCDIR([Makefile.in]) AC_CONFIG_HEADER(config.h) wi_LIB_READLINE # Required programs # =========================================================================== AC_PROG_CC AC_PROG_CPP AC_PROG_INSTALL AC_PROG_RANLIB AC_CHECK_PROG(AUTOCONF, autoconf, autoconf, :) AC_CHECK_PROG(STRIP, strip, strip, :) AC_CHECK_PROG(AS, as, as, :) AC_CHECK_PROG(CP, cp, cp, :) AC_LANG_C # Checking for header files. # =========================================================================== socket_type=unknown AC_CHECK_HEADERS(sys/socket.h, socket_type=sys_socket_h) if test $socket_type = unknown; then AC_CHECK_HEADERS(winsock2.h, socket_type=winsock2_h) fi # Checking for functions/libs # =========================================================================== if test $socket_type = winsock2_h; then LIBS="-lws2_32 $LIBS" else AC_CHECK_LIB(socket,socket) AC_CHECK_LIB(nsl,xdr_short) fi # Macro definitions # =========================================================================== # adl_DD_COPT macro checks if the compiler specified as the 1st parameter # supports option specified as the 2nd parameter # For example: DD_CPORT(CXX, fPIC) AC_DEFUN(adl_DD_COPT, [ AC_CACHE_CHECK(whether $$1 accepts -$2,sdcc_cv_$1$2, cat >_test_.c < void main(void) {} EOF $$1 -v -$2 -c _test_.c 1>&5 2>&5 if test "$?" = "0"; then sdcc_cv_$1$2="yes" else sdcc_cv_$1$2="no" fi rm -f _test_.* a.out) ]) # This macro expands DIR and assigns it to RET. # If DIR is NONE, then it's replaced by DEFAULT. # # Based on AC_DEFINE_DIR # # Examples: # # adl_EXPAND(prefix, "/usr/local", expanded_prefix) AC_DEFUN([adl_EXPAND], [ test "x$prefix" = xNONE && prefix="$ac_default_prefix" test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' ac_expand=[$]$1 test "x$ac_expand" = xNONE && ac_expand="[$]$2" ac_expand=`eval echo [$]ac_expand` $3=`eval echo [$]ac_expand` ]) # adl_NORMALIZE_PATH # # - empty paths are changed to '.' # - trailing slashes are removed # - repeated slashes are squeezed except a leading doubled slash '//' # (which might indicate a networked disk on some OS). # # # REFERENCE_STRING is used to turn '/' into '\' and vice-versa: if # REFERENCE_STRING contains some backslashes, all slashes and backslashes # are turned into backslashes, otherwise they are all turned into slashes. # # This makes processing of DOS filenames quite easier, because you can turn a # filename to the Unix notation, make your processing, and turn it back to # original notation. dnl Available from the GNU Autoconf Macro Archive at: dnl http://www.gnu.org/software/ac-archive/htmldoc/normpath.html dnl AC_DEFUN([adl_NORMALIZE_PATH], [case ":[$]$1:" in dnl change empty paths to '.' ::) $1='.' ;; dnl strip trailing slashes :*[[\\/]]:) $1=`echo "[$]$1" | sed 's,[[\\/]]*[$],,'` ;; :*:) ;; esac dnl squeze repeated slashes case ifelse($2,,"[$]$1",$2) in dnl if the path contains any backslashes, turn slashes into backslashes dnl Bernhard Held 2003-04-06 dnl This was the original line. It does not: dnl - convert the first slash dnl - replace a slash with a double-backslash dnl *\\*) $1=`echo "[$]$1" | sed 's,\(.\)[[\\/]][[\\/]]*,\1\\\\,g'` ;; *\\*) $1=`echo "[$]$1" | sed 's,\(.\)[[\\/]][[\\/]]*,\1\\\\\\\\,g s,^[[\\/]],\\\\\\\\,'` ;; dnl if the path contains slashes, also turn backslashes into slashes *) $1=`echo "[$]$1" | sed 's,\(.\)[[\\/]][[\\/]]*,\1/,g'` ;; esac]) dnl adl_NORMALIZE_DEFINE_UNQUOTED(var, DEFINE, REFERENCE_STRING) AC_DEFUN([adl_NORMALIZE_DEFINE_UNQUOTED], [ ac_ndu=[$]$1 adl_NORMALIZE_PATH([ac_ndu], [$]$3) AC_DEFINE_UNQUOTED($2, "${ac_ndu}") ]) # Checking characteristics of compilers and other programs # =========================================================================== AC_CACHE_CHECK(whether preprocessor accepts -MM or -M,sdcc_cv_MM, echo "#include " >_test_.c echo "" >>_test_.c $CPP -v -MM _test_.c 1>&5 2>&5 if test "$?" = "0"; then sdcc_cv_MM="-MM" else sdcc_cv_MM="-M" fi rm -f _test_.*) M_OR_MM=$sdcc_cv_MM AC_SUBST(M_OR_MM) # This is the first time when CFLAGS are set/modified!! adl_DD_COPT(CC, ggdb) if test "$sdcc_cv_CCggdb" = "yes"; then CFLAGS="-ggdb ${CFLAGS}" fi adl_DD_COPT(CC, pipe) if test "$sdcc_cv_CCpipe" = "yes"; then CFLAGS="-pipe $CFLAGS" fi # Set standard installation paths # =========================================================================== # In the Makefiles we need paths with '/' as directory separator, even if # crosscompiling for Win32. # And we want to preserve the macros (e.g. ${prefix}) in the Makefiles. # The variables in the Makefiles are replaced by AC_SUBST() # # In sdccconf.h the '/' in paths can be replaced by "\\" (normalized), if # # The macros are expanded for the header. # The variables in the header are replaced by AC_*DEFINE*() # sdccconf_h_dir_separator contains a backslash. AC_ARG_VAR(sdccconf_h_dir_separator, needed in sdccconf.h: either "/" (default) or "\\") if test "x${sdccconf_h_dir_separator}" = "x"; then sdccconf_h_dir_separator="/" fi # Makefiles ########### # lib_dir_suffix: # *nix default: "sdcc/lib" AC_ARG_VAR(lib_dir_suffix, appended to datadir to define SDCC's library root directory) if test "${lib_dir_suffix}" = ""; then lib_dir_suffix="sdcc/lib" fi AC_SUBST(lib_dir_suffix) AC_SUBST(EXEEXT) # sdccconf.h ############ AC_DEFINE_UNQUOTED(DIR_SEPARATOR_STRING, "${sdccconf_h_dir_separator}") # datadir: # default: "${prefix}/share" adl_EXPAND(datadir, "NONE", expanded_datadir) adl_NORMALIZE_DEFINE_UNQUOTED(expanded_datadir, DATADIR, sdccconf_h_dir_separator) # lib suffix norm_lib_dir_suffix=${lib_dir_suffix} adl_NORMALIZE_PATH([norm_lib_dir_suffix], [$sdccconf_h_dir_separator]) AC_DEFINE_UNQUOTED(LIB_DIR_SUFFIX, DIR_SEPARATOR_STRING "${norm_lib_dir_suffix}") # Generating output files # =========================================================================== AC_CONFIG_FILES([Makefile]) AC_OUTPUT # End of configure/configure.in