Fix missing prototypes for HAVE_NS (caused crash) and vrious warnings.
[bpt/emacs.git] / configure.in
index aee62c0..92d2e9d 100644 (file)
@@ -327,6 +327,8 @@ else
    PROFILING_CFLAGS=
    PROFILING_LDFLAGS=
 fi
+AC_SUBST(PROFILING_CFLAGS)
+AC_SUBST(PROFILING_LDFLAGS)
 
 AC_ARG_ENABLE(autodepend,
 [AS_HELP_STRING([--enable-autodepend],
@@ -721,10 +723,8 @@ then
 fi
 
 if test x$GCC = xyes; then
-  C_OPTIMIZE_SWITCH=-O2
   test "x$GCC_TEST_OPTIONS" != x && CC="$CC $GCC_TEST_OPTIONS"
 else
-  C_OPTIMIZE_SWITCH=-O
   test "x$NON_GCC_TEST_OPTIONS" != x && CC="$CC $NON_GCC_TEST_OPTIONS"
 fi
 
@@ -770,6 +770,7 @@ AC_MSG_RESULT($has_option)
 CFLAGS="$SAVE_CFLAGS"
 unset has_option
 unset SAVE_CFLAGS
+AC_SUBST(C_WARNINGS_SWITCH)
 
 
 #### Some other nice autoconf tests.
@@ -861,35 +862,12 @@ AC_LINK_IFELSE([main(){return 0;}],
   LDFLAGS=$late_LDFLAGS
   [AC_MSG_RESULT(no)])
 
-LDFLAGS="${LDFLAGS} ${PROFILING_LDFLAGS}"
-
 
 # The value of CPP is a quoted variable reference, so we need to do this
 # to get its actual value...
 CPP=`eval "echo $CPP"`
 
 
-### First figure out CFLAGS (which we use for running the compiler here)
-### and REAL_CFLAGS (which we use for real compilation).
-### The two are the same except when using GCC where we might use
-### extra warning and profiling flags.
-
-### If the CFLAGS env var is specified, we use that value
-### instead of the default.
-
-dnl Note AC_PROG_CC sets CFLAGS to -g -O2 for gcc anyway.
-if test "x$SPECIFIED_CFLAGS" = x; then
-  CFLAGS="-g $C_OPTIMIZE_SWITCH"
-  if test x$GCC = xyes; then
-    REAL_CFLAGS="$CFLAGS $C_WARNINGS_SWITCH $PROFILING_CFLAGS"
-  else
-    REAL_CFLAGS="$CFLAGS"
-  fi
-else
-  REAL_CFLAGS="$CFLAGS"
-fi
-
-
 dnl Not used by any currently supported platform.
 dnl The function dump-emacs will not be defined and temacs will do
 dnl (load "loadup") automatically unless told otherwise.
@@ -905,7 +883,7 @@ AC_SUBST(CANNOT_DUMP)
 
 UNEXEC_OBJ=unexelf.o
 case "$opsys" in
-  # MSDOS uses unexec.o
+  # MSDOS uses unexcoff.o
   # MSWindows uses unexw32.o
   aix4-2)
    UNEXEC_OBJ=unexaix.o
@@ -1088,7 +1066,7 @@ START_FILES=
 case $opsys in
   cygwin )
     LIB_MATH=
-    START_FILES='ecrt0.o'
+    START_FILES='pre-crt0.o'
     ;;
   darwin )
     ## Adding -lm confuses the dynamic linker, so omit it.
@@ -1232,7 +1210,7 @@ AC_CHECK_HEADERS(sys/select.h sys/timeb.h sys/time.h unistd.h utime.h \
   linux/version.h sys/systeminfo.h termios.h limits.h string.h stdlib.h \
   stdio_ext.h fcntl.h strings.h coff.h pty.h sys/mman.h \
   sys/param.h sys/vlimit.h sys/resource.h locale.h sys/_mbstate_t.h \
-  sys/utsname.h pwd.h utmp.h)
+  sys/utsname.h pwd.h utmp.h dirent.h util.h)
 
 AC_MSG_CHECKING(if personality LINUX32 can be set)
 AC_TRY_COMPILE([#include <sys/personality.h>], [personality (PER_LINUX32)],
@@ -1497,7 +1475,7 @@ tmp_CPPFLAGS="$CPPFLAGS"
 tmp_CFLAGS="$CFLAGS"
 CPPFLAGS="$CPPFLAGS -x objective-c"
 CFLAGS="$CFLAGS -x objective-c"
-TEMACS_LDFLAGS2="\${LDFLAGS}"
+TEMACS_LDFLAGS2="\${LDFLAGS} \${PROFILING_LDFLAGS}"
 dnl I don't think it's especially important, but src/Makefile.in
 dnl (now the only user of ns_appdir) used to go to the trouble of adding a
 dnl trailing "/" to it, so now we do it here.
@@ -1526,7 +1504,6 @@ if test "${with_ns}" != no; then
        GNUSTEP_LOCAL_LIBRARIES="-L${GNUSTEP_LOCAL_LIBRARIES}"
      CPPFLAGS="$CPPFLAGS -I${GNUSTEP_SYSTEM_HEADERS} ${GNUSTEP_LOCAL_HEADERS}"
      CFLAGS="$CFLAGS -I${GNUSTEP_SYSTEM_HEADERS} ${GNUSTEP_LOCAL_HEADERS}"
-     REAL_CFLAGS="$REAL_CFLAGS -I${GNUSTEP_SYSTEM_HEADERS} ${GNUSTEP_LOCAL_HEADERS}"
      LDFLAGS="$LDFLAGS -L${GNUSTEP_SYSTEM_LIBRARIES} ${GNUSTEP_LOCAL_LIBRARIES}"
      LIB_STANDARD=
      START_FILES=
@@ -1732,6 +1709,7 @@ esac
 # used for the tests that follow.  We set them back to REAL_CFLAGS and
 # REAL_CPPFLAGS later on.
 
+REAL_CFLAGS="$CFLAGS"
 REAL_CPPFLAGS="$CPPFLAGS"
 
 if test "${HAVE_X11}" = "yes"; then
@@ -2635,11 +2613,11 @@ rename closedir mkdir rmdir sysinfo getrusage get_current_dir_name \
 random lrand48 logb frexp fmod rint cbrt ftime setsid \
 strerror fpathconf select mktime euidaccess getpagesize tzset setlocale \
 utimes getrlimit setrlimit setpgid getcwd getwd shutdown getaddrinfo \
-__fpending mblen mbrlen mbsinit strsignal setitimer ualarm index rindex \
+__fpending mblen mbrlen mbsinit strsignal setitimer ualarm strchr strrchr \
 sendto recvfrom getsockopt setsockopt getsockname getpeername \
 gai_strerror mkstemp getline getdelim mremap memmove fsync sync \
 memset memcmp difftime memcpy mempcpy mblen mbrlen posix_memalign \
-cfmakeraw cfsetspeed isnan copysign)
+cfmakeraw cfsetspeed isnan copysign __executable_start)
 
 AC_CHECK_HEADERS(sys/un.h)
 
@@ -3354,9 +3332,7 @@ LINKER=
 ORDINARY_LINK=
 case "$opsys" in
   ## gnu: GNU needs its own crt0.
-  aix4-2|darwin|gnu|usg5-4|irix6-5|sol2*|unixware) ORDINARY_LINK=yes ;;
-
-  cygwin) LINKER="\$(CC)" ;;
+  aix4-2|cygwin|darwin|gnu|irix6-5|sol2*|unixware) ORDINARY_LINK=yes ;;
 
   ## On post 1.3 releases of NetBSD, gcc -nostdlib also clears the
   ## library search parth, i.e. it won't search /usr/lib for libc and
@@ -3409,8 +3385,7 @@ LIB_GCC=
 if test "x$GCC" = "xyes" && test "x$ORDINARY_LINK" != "xyes"; then
 
   case "$opsys" in
-    ## cygwin: don't link against static libgcc.
-    cygwin|freebsd|netbsd|openbsd) LIB_GCC= ;;
+    freebsd|netbsd|openbsd) LIB_GCC= ;;
 
     gnu-*)
       ## armin76@gentoo.org reported that the lgcc_s flag is necessary to
@@ -3601,6 +3576,14 @@ void *alloca (size_t);
 typedef unsigned size_t;
 #endif
 
+#ifndef HAVE_STRCHR
+#define strchr(a, b) index (a, b)
+#endif
+
+#ifndef HAVE_STRRCHR
+#define strrchr(a, b) rindex (a, b)
+#endif
+
 #if defined __GNUC__ && (__GNUC__ > 2 \
                          || (__GNUC__ == 2 && __GNUC_MINOR__ >= 5))
 #define NO_RETURN      __attribute__ ((__noreturn__))