comparison configure1.in @ 2499:da67547eda51

* configure.in: When checking for X windows, search for an X11 subdirectory of ${x_includes}. * configure.in: Check for gettimeofday function, for getdate.y. Change `configure' to a mixture of custom code and autoconf stuff. autoconf can't derive all the information we need, but we'd really like to be able to take advantage of some of its tests, and its file-editing facilities. * configure.in: Renamed from configure. Quote the sections of shell script we want copied literally to the configure script. (compile): Initialize this to make the autoconf macros' code happy. Use AC_PROG_CC, AC_CONST, and AC_RETSIGTYPE instead of writing out code to do their jobs. Use autoconf to produce Makefile and src/config.h. Remove the Makefile-style comment that autoconf places at the top of src/config.h. (config_h_opts): Removed - no longer necessary. * Makefile.in (configname): Renamed to configuration. (CONFIG_CFLAGS): Renamed to DEFS. (CC, DEFS, C_SWITCH_SYSTEM, version, configuration): Adjusted to get values via autoload @cookies@. (libsrc_libs): Get this from autoconf. We used to do nothing about this. (${SUBDIR}): Pass DEFS to submakes instead of CONFIG_CFLAGS.
author Jim Blandy <jimb@redhat.com>
date Sat, 10 Apr 1993 06:02:36 +0000
parents ed2ea3a2fc36
children a5cb0d9f5916
comparison
equal deleted inserted replaced
2498:0126ca788e99 2499:da67547eda51
1 1 [
2 ### The above line is deliberately left blank. If it starts with a #, 2 ### The above line is deliberately left blank. If it starts with a #,
3 ### some CSH's will think this is a csh script. 3 ### some CSH's will think this is a csh script.
4 4
5 #### Configuration script for GNU Emacs 5 #### Configuration script for GNU Emacs
6 #### Copyright (C) 1992 Free Software Foundation, Inc. 6 #### Copyright (C) 1992 Free Software Foundation, Inc.
19 19
20 ### You should have received a copy of the GNU General Public License 20 ### You should have received a copy of the GNU General Public License
21 ### along with GNU Emacs; see the file COPYING. If not, write to 21 ### along with GNU Emacs; see the file COPYING. If not, write to
22 ### the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. 22 ### the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
23 23
24 ### Shell script to edit files and make symlinks in preparation for 24
25 ### compiling Emacs. 25 ### Since Emacs has configuration requirements that autoconf can't
26 ### meet, this file is an unholy marriage of custom-baked
27 ### configuration code and autoconf macros. New versions of autoconf
28 ### could very well break this arrangement.
29 ###
30 ### We omit the invocation of autoconf's initialization function,
31 ### because it produces Bourne shell code to parse arguments, but we
32 ### need to parse our own arguments.
33 ###
34 ### We use the m4 quoting characters [ ] (as established by the
35 ### autoconf system) to include large sections of raw sewage - Oops, I
36 ### mean, shell code - in the final configuration script.
26 ### 37 ###
27 ### Usage: configure config_name 38 ### Usage: configure config_name
28 ### 39 ###
29 ### If configure succeeds, it leaves its status in config.status. 40 ### If configure succeeds, it leaves its status in config.status.
30 ### If configure fails after disturbing the status quo, 41 ### If configure fails after disturbing the status quo,
89 If successful, ${progname} leaves its status in config.status. If 100 If successful, ${progname} leaves its status in config.status. If
90 unsuccessful after disturbing the status quo, it removes config.status." 101 unsuccessful after disturbing the status quo, it removes config.status."
91 102
92 103
93 #### Option processing. 104 #### Option processing.
94
95 ### These are the names of CPP symbols we want to define or leave undefined
96 ### in src/config.h; their values are given by the shell variables of the same
97 ### names.
98 config_h_opts=" \
99 HAVE_X_WINDOWS HAVE_X11 HAVE_X_MENU \
100 SIGTYPE GNU_MALLOC REL_ALLOC LISP_FLOAT_TYPE HAVE_CONST \
101 LD_SWITCH_X_SITE C_SWITCH_X_SITE HAVE_XFREE386"
102 105
103 ### Record all the arguments, so we can save them in config.status. 106 ### Record all the arguments, so we can save them in config.status.
104 arguments="$@" 107 arguments="$@"
105 108
106 while [ $# != 0 ]; do 109 while [ $# != 0 ]; do
766 fi 769 fi
767 770
768 machfile="m/${machine}.h" 771 machfile="m/${machine}.h"
769 opsysfile="s/${opsys}.h" 772 opsysfile="s/${opsys}.h"
770 773
774 #### Set some things up for the autoconf macros.
775 trap 'rm -f conftest* core; exit 1' 1 3 15
776
777 rm -f conftest*
778 compile='${CC-cc} $CFLAGS $DEFS conftest.c -o conftest $LIBS >/dev/null 2>&1'
779
780
781 #### Choose a compiler.
782 DEFS=-g
783 case ${with_gcc} in
784 "yes" ) CC="gcc -O99" GCC=1 ;;
785 "no" ) CC="cc" ;;
786 * )
787 ]
788 AC_PROG_CC
789 [
790 esac
791
792 #### Some other nice autoconf tests.
793 ]
794 AC_CONST
795 AC_RETSIGTYPE
796 AC_HAVE_FUNCS(gettimeofday)
797 [
798
771 799
772 #### Choose a window system. 800 #### Choose a window system.
773 echo "Checking window system." 801 echo "Checking window system."
774 window_system='' 802 window_system=''
775 case "${with_x}" in 803 case "${with_x}" in
795 "" ) 823 "" )
796 echo " No window system specifed. Looking for X Windows." 824 echo " No window system specifed. Looking for X Windows."
797 window_system=none 825 window_system=none
798 if [ -r /usr/lib/libX11.a \ 826 if [ -r /usr/lib/libX11.a \
799 -o -d /usr/include/X11 \ 827 -o -d /usr/include/X11 \
800 -o -d /usr/X386/include ]; then 828 -o -d /usr/X386/include \
829 -o -d ${x_includes}/X11 ]; then
801 window_system=x11 830 window_system=x11
802 fi 831 fi
803 ;; 832 ;;
804 * ) 833 * )
805 echo "Don\'t specify the window system more than once." >&2 834 echo "Don\'t specify the window system more than once." >&2
842 C_SWITCH_X_SITE="-I/usr/X386/include" 871 C_SWITCH_X_SITE="-I/usr/X386/include"
843 fi 872 fi
844 fi 873 fi
845 ;; 874 ;;
846 esac 875 esac
847
848 #### Choose a compiler.
849 echo "Checking compilers."
850 if [ "${with_gcc}" = "" ]; then
851 echo " Searching load path for GCC."
852 temppath=`echo $PATH | sed 's/^:/.:/
853 s/::/:.:/g
854 s/:$/:./
855 s/:/ /g'`
856 default_cc=`(
857 for dir in ${temppath}; do
858 if [ -f ${dir}/gcc ]; then echo gcc; exit 0; fi
859 done
860 echo cc
861 )`
862 else
863 case ${with_gcc} in
864 "yes" ) default_cc="gcc" ;;
865 "no" ) default_cc="cc" ;;
866 esac
867 fi
868
869 case "${default_cc}" in
870 "gcc" )
871 echo " Using GCC."
872 default_cflags='-g -O'
873 ;;
874 * )
875 echo " Using the system's CC."
876 default_cflags='-g'
877 ;;
878 esac
879
880
881 #### Does this compiler support the `const' keyword?
882 #### The code for this test was adapted from autoconf's test.
883 echo "Checking if the compiler supports \`const'."
884 rm -f conftest*
885 compile='${default_cc} conftest.c -o conftest >/dev/null 2>&1'
886 echo "
887 main() { exit(0); } t() {
888 /* Ultrix mips cc rejects this. */
889 typedef int charset[2]; const charset x;
890 /* SunOS 4.1.1 cc rejects this. */
891 char const *const *p;
892 char **p2;
893 /* AIX 3.2 cc rejects this. */
894 p += p ? p-p : 0;
895 /* HPUX 7.0 cc rejects these. */
896 ++p;
897 p2 = (char const* const*) p;
898 }" > conftest.c
899 if eval $compile; then
900 echo " It seems to."
901 HAVE_CONST=yes
902 else
903 echo " It doesn't seem to."
904 HAVE_CONST=no
905 fi
906 rm -f conftest*
907
908 #### What is the return type of a signal handler?
909
910 ### We run /usr/include/signal.h through cpp and grep for the
911 ### declaration of the signal function. Yuck.
912 echo "Looking for return type of signal handler functions."
913 signal_h_file=''
914 if [ -r /usr/include/signal.h ]; then
915 signal_h_file=/usr/include/signal.h
916 elif [ -r /usr/include/sys/signal.h ]; then
917 signal_h_file=/usr/include/sys/signal.h
918 fi
919 SIGTYPE=void
920 if [ "${signal_h_file}" ]; then
921 sigpattern='[ ]*([ ]*\*[ ]*signal[ ]*('
922
923 ## We make a copy whose name ends in .c, so the compiler
924 ## won't complain about having only been given a .h file.
925 tempcname="configure.tmp.$$.c"
926 cp ${signal_h_file} ${tempcname}
927 if ${default_cc} -E ${tempcname} | grep "int${sigpattern}" > /dev/null; then
928 SIGTYPE=int
929 fi
930 rm -f ${tempcname}
931 fi
932 echo " Guessing that signals return \`${SIGTYPE}'."
933
934 876
935 #### Extract some information from the operating system and machine files. 877 #### Extract some information from the operating system and machine files.
936 878
937 echo "Examining the machine- and system-dependent files to find out" 879 echo "Examining the machine- and system-dependent files to find out"
938 echo " - which libraries the lib-src programs will want, and" 880 echo " - which libraries the lib-src programs will want, and"
956 @configure@ system_malloc=yes 898 @configure@ system_malloc=yes
957 #else 899 #else
958 @configure@ system_malloc=no 900 @configure@ system_malloc=no
959 #endif 901 #endif
960 ' > ${tempcname} 902 ' > ${tempcname}
961 eval `${default_cc} -E ${tempcname} \ 903 eval `${CC} -E ${tempcname} \
962 | grep '@configure@' \ 904 | grep '@configure@' \
963 | sed -e 's/^@configure@ \([^=]*=\)\(.*\)$/\1"\2"/'` 905 | sed -e 's/^@configure@ \([^=]*=\)\(.*\)$/\1"\2"/'`
964 rm ${tempcname} 906 rm ${tempcname}
907
965 908
966 # Do the opsystem or machine files prohibit the use of the GNU malloc? 909 # Do the opsystem or machine files prohibit the use of the GNU malloc?
967 # Assume not, until told otherwise. 910 # Assume not, until told otherwise.
968 GNU_MALLOC=yes 911 GNU_MALLOC=yes
969 if [ "${system_malloc}" = "yes" ]; then 912 if [ "${system_malloc}" = "yes" ]; then
987 \`${srcdir}/lisp/version.el'." >&2 930 \`${srcdir}/lisp/version.el'." >&2
988 exit 1 931 exit 1
989 fi 932 fi
990 933
991 934
992 #### Make the proper settings in `src/config.h'. 935 #### Specify what sort of things we'll be editing into our Makefiles.
993 rm -f config.status 936 ]
994 set -e 937 AC_SUBST(configuration)
995 938 AC_SUBST(version)
996 echo "Making \`./src/config.h' from \`${srcdir}/src/config.h.in'." 939 AC_SUBST(srcdir)
997 sed_flags="-e 's:@machine@:${machfile}:' -e 's:@opsystem@:${opsysfile}:'" 940 AC_SUBST(c_switch_system)
998 941 AC_SUBST(libsrc_libs)
999 for flag in ${config_h_opts}; do 942 AC_SUBST(machfile)
1000 val=`eval echo '$'${flag}` 943 AC_SUBST(opsysfile)
1001 case ${val} in 944 AC_SUBST(LD_SWITCH_X_SITE)
1002 no | "") 945 AC_SUBST(C_SWITCH_X_SITE)
1003 f="-e 's:.*#define ${flag}.*:/\\* #define ${flag} \\*/:'" 946 [
1004 ;; 947 if [ "${HAVE_X_WINDOWS}" = "yes" ] ; then
1005 yes) 948 ] AC_DEFINE(HAVE_X_WINDOWS) [
1006 f="-e 's:.*#define ${flag}.*:#define ${flag}:'" 949 fi
1007 ;; 950 if [ "${HAVE_X11}" = "yes" ] ; then
1008 *) 951 ] AC_DEFINE(HAVE_X11) [
1009 f="-e 's:.*#define ${flag}.*:#define ${flag} ${val}:'" 952 fi
1010 ;; 953 if [ "${HAVE_XFREE386}" = "yes" ] ; then
1011 esac 954 ] AC_DEFINE(HAVE_XFREE386) [
1012 sed_flags="${sed_flags} ${f}" 955 fi
1013 done 956 if [ "${HAVE_X_MENU}" = "yes" ] ; then
1014 957 ] AC_DEFINE(HAVE_X_MENU) [
1015 rm -f ./src/config.h.tmp 958 fi
1016 (echo "/* This file is generated by \`${progname}' from" 959 if [ "${GNU_MALLOC}" = "yes" ] ; then
1017 echo " \`${srcdir}/src/config.h.in'." 960 ] AC_DEFINE(GNU_MALLOC) [
1018 echo " If you are thinking about editing it, you should seriously consider" 961 fi
1019 echo " running \`${progname} instead, or editing" 962 if [ "${REL_ALLOC}" = "yes" ] ; then
1020 echo " \`${srcdir}/src/config.h.in' itself." 963 ] AC_DEFINE(REL_ALLOC) [
1021 eval '/bin/sed '${sed_flags}' < "${srcdir}/src/config.h.in"' 964 fi
1022 ) > src/config.h.tmp 965 if [ "${LISP_FLOAT_TYPE}" = "yes" ] ; then
1023 ${srcdir}/move-if-change src/config.h.tmp src/config.h 966 ] AC_DEFINE(LISP_FLOAT_TYPE) [
1024 ### Remind people not to edit this. 967 fi
1025 chmod -w src/config.h 968
1026 969
1027 970 #### Report on what we decided to do.
1028 #### Modify the parameters in the top-level Makefile. 971 echo "
1029 echo "Producing \`Makefile' from \`${srcdir}/Makefile.in'." 972
1030 rm -f Makefile.tmp 973 Configured for \`${configuration}'.
1031 (echo "\
1032 # This file is generated by \`${progname}' from
1033 # \`${srcdir}/Makefile.in'.
1034 # If you are thinking about editing it, you should seriously consider
1035 # running \`${progname}' instead, or editing
1036 # \`${srcdir}/Makefile.in' itself."
1037 /bin/sed < ${srcdir}/Makefile.in \
1038 -e 's|^configname *=.*$|configname='"${configuration}"'|' \
1039 -e 's|^version *=.*$|version='"${version}"'|' \
1040 -e 's|^srcdir *=.*$|srcdir='"${srcdir}"'|' \
1041 -e 's|^CC *=.*$|CC='"${default_cc}"'|' \
1042 -e 's|^CONFIG_CFLAGS *=.*$|CONFIG_CFLAGS='"${default_cflags}"'|' \
1043 -e 's|^C_SWITCH_SYSTEM *=.*$|C_SWITCH_SYSTEM='"${c_switch_system}"'|' \
1044 -e 's|^LOADLIBES *=.*$|LOADLIBES='"${libsrc_libs}"'|' \
1045 -e '/^# DIST: /d') > Makefile.tmp
1046 ${srcdir}/move-if-change Makefile.tmp Makefile
1047
1048 ### I'm commenting out this section until I bring the `build-install' script
1049 ### into line with the rest of the configuration stuff.
1050
1051 ### # Modify the parameters in the `build-install' script.
1052 ### echo "Producing \`./build-install' from \`${srcdir}/build-install.in'."
1053 ### rm -f ./build-install.tmp
1054 ### (echo "\
1055 ### # This file is generated by \`${progname}' from \`${srcdir}/build-install.in'.
1056 ### # If you are thinking about editing it, you should seriously consider
1057 ### # editing \`./build-install.in' itself, or running \`${progname}' instead."
1058 ### /bin/sed < ${srcdir}/build-install.in \
1059 ### -e 's;^\(prefix=\).*$;\1'"${prefix};" \
1060 ### -e 's;^\(bindir=\).*$;\1'"${bindir};" \
1061 ### -e 's;^\(lisppath=\).*$;\1'"${lisppath};" \
1062 ### -e 's;^\(datadir=\).*$;\1'"${datadir};" \
1063 ### -e 's;^\(lockdir=\).*$;\1'"${lockdir};" \
1064 ### -e 's;^\(libdir=\).*$;\1'"${libdir};") > ./build-install.tmp
1065 ### ${srcdir}/move-if-change build-install.tmp build-install
1066 ### # Remind people not to edit this.
1067 ### chmod -w build-install
1068 ### chmod +x build-install
1069
1070
1071 #### Describe the results.
1072
1073 ### Create a verbal description of what we have done.
1074
1075 message="Configured for \`${configuration}'.
1076 974
1077 What operating system and machine description files should Emacs use? 975 What operating system and machine description files should Emacs use?
1078 \`${opsysfile}' and \`${machfile}' 976 \`${opsysfile}' and \`${machfile}'
977 What compiler should emacs be built with? ${CC} -g
1079 Should Emacs use the GNU version of malloc? ${GNU_MALLOC}${GNU_MALLOC_reason} 978 Should Emacs use the GNU version of malloc? ${GNU_MALLOC}${GNU_MALLOC_reason}
1080 Should Emacs use the relocating allocator for buffers? ${REL_ALLOC} 979 Should Emacs use the relocating allocator for buffers? ${REL_ALLOC}
1081 What window system should Emacs use? ${window_system} 980 What window system should Emacs use? ${window_system}${x_includes+
1082 What compiler should emacs be built with? ${default_cc}
1083 Should the compilation use \`-g' and/or \`-O'? ${default_cflags-neither}${x_includes+
1084 Where do we find X Windows header files? }${x_includes}${x_libraries+ 981 Where do we find X Windows header files? }${x_includes}${x_libraries+
1085 Where do we find X Windows libraries? }${x_libraries}" 982 Where do we find X Windows libraries? }${x_libraries}
1086 983
1087 ### Write config.status, documenting the damage we have done.
1088
1089 (echo "\
1090 #!/bin/sh
1091 ### This file is generated by \`${progname}.'
1092 ### If you are thinking about editing it, you should seriously consider
1093 ### running \`${progname}' instead.
1094 " 984 "
1095 echo "${message}" | sed -e 's/^/# /' 985
1096 echo "exec '${progname}' ${arguments} "'$@') > config.status 986 ### Restore the arguments to this script, so autoconf can record them
1097 987 ### in the config.status file.
1098 ### Remind people not to edit this. 988 set - ${arguments}
1099 chmod -w config.status 989 ]
1100 chmod +x config.status 990 AC_OUTPUT(Makefile src/config.h)
1101 991 [
1102 ### Print the description. 992
1103 echo 993 ### Autoconf likes to add a Makefile comment to the top of
1104 echo "${message}" 994 ### src/config.h. Do you have a better idea?
1105 995 (cd src
1106 exit 0 996 sed < config.h > conftemp.$$ '1d'
997 mv conftemp.$$ config.h)
998
999 ]