File: autoconf.info, Node: System Services, Next: C and Posix Variants, Prev: Compilers and Preprocessors, Up: Existing Tests 5.11 System Services ==================== The following macros check for operating system services or capabilities. -- Macro: AC_PATH_X Try to locate the X Window System include files and libraries. If the user gave the command line options ‘--x-includes=DIR’ and ‘--x-libraries=DIR’, use those directories. If either or both were not given, get the missing values by running ‘xmkmf’ (or an executable pointed to by the ‘XMKMF’ environment variable) on a trivial ‘Imakefile’ and examining the makefile that it produces. Setting ‘XMKMF’ to ‘false’ disables this method. If this method fails to find the X Window System, ‘configure’ looks for the files in several directories where they often reside. If either method is successful, set the shell variables ‘x_includes’ and ‘x_libraries’ to their locations, unless they are in directories the compiler searches by default. If both methods fail, or the user gave the command line option ‘--without-x’, set the shell variable ‘no_x’ to ‘yes’; otherwise set it to the empty string. -- Macro: AC_PATH_XTRA An enhanced version of ‘AC_PATH_X’. It adds the C compiler flags that X needs to output variable ‘X_CFLAGS’, and the X linker flags to ‘X_LIBS’. Define ‘X_DISPLAY_MISSING’ if X is not available. This macro also checks for special libraries that some systems need in order to compile X programs. It adds any that the system needs to output variable ‘X_EXTRA_LIBS’. And it checks for special X11R6 libraries that need to be linked with before ‘-lX11’, and adds any found to the output variable ‘X_PRE_LIBS’. -- Macro: AC_SYS_INTERPRETER Check whether the system supports starting scripts with a line of the form ‘#!/bin/sh’ to select the interpreter to use for the script. After running this macro, shell code in ‘configure.ac’ can check the shell variable ‘interpval’; it is set to ‘yes’ if the system supports ‘#!’, ‘no’ if not. -- Macro: AC_SYS_LARGEFILE If the default ‘off_t’ type is a 32-bit integer, and therefore cannot be used with files 2 GiB or larger, make a wider ‘off_t’ available if the system supports it. Similarly, widen other types related to sizes of files and file systems if possible. These types may include ‘blkcnt_t’, ‘dev_t’, ‘ino_t’, ‘fsblkcnt_t’, ‘fsfilcnt_t’, and ‘rlim_t’. Also, arrange for a ‘configure’ option ‘--enable-year2038’ to request widening the type ‘time_t’ as needed to represent file wand other timestamps after mid-January 2038. This widening is possible only on 32-bit GNU/Linux x86 and ARM systems with glibc 2.34 or later. If year-2038 support is requested but ‘configure’ fails to find a way to widen ‘time_t’ and inspection of the system suggests that this feature is available somehow, ‘configure’ will error out. If you want the default to be ‘--enable-year2038’, you can use ‘AC_SYS_YEAR2038’ or ‘AC_SYS_YEAR2038_RECOMMENDED’ instead of ‘AC_SYS_LARGEFILE’. In other words, older packages that have long used ‘AC_SYS_LARGEFILE’ can have year-2038 support on 32-bit GNU/Linux x86 and ARM systems either by regenerating ‘configure’ with current Autoconf and configuring with ‘--enable-year2038’, or by using ‘AC_SYS_YEAR2038’ or ‘AC_SYS_YEAR2038_RECOMMENDED’ and configuring without ‘--disable-year2038’. A future version of Autoconf might change the ‘AC_SYS_LARGEFILE’ default to ‘--enable-year2038’; if and when that happens, ‘AC_SYS_LARGEFILE’ and ‘AC_SYS_YEAR2038’ will become equivalent. *Note AC_SYS_YEAR2038::. Set the shell variable ‘ac_have_largefile’ to ‘yes’ or ‘no’ depending on whether a wide ‘off_t’ is available, regardless of whether arrangements were necessary. Similarly, set the shell variable ‘ac_have_year2038’ to ‘yes’ or ‘no’ depending on whether a wide-enough ‘time_t’ is available. Define preprocessor macros if necessary to make types wider; for example, on GNU/Linux systems the macros ‘_FILE_OFFSET_BITS’ and ‘_TIME_BITS’ can be defined. Some of these macros work only if defined before the first system header is included; therefore, when using this macro in concert with ‘AC_CONFIG_HEADERS’, make sure that ‘config.h’ is included before any system headers. On obsolete IRIX systems, also change the output variable ‘CC’ to add compiler options needed for wide ‘off_t’. Large-file support can be disabled by configuring with the ‘--disable-largefile’ option, and year-2038 support can be enabled and disabled via the ‘--enable-year2038’ and ‘--disable-year2038’ options. These options have no effect on systems where types are wide enough by default. Large-file support is required for year-2038 support: if you configure with ‘--disable-largefile’ on a platform with 32-bit ‘time_t’, then year-2038 support is not available. Disabling large-file or year-2038 support can have surprising effects, such as causing functions like ‘readdir’ and ‘stat’ to fail even on a small file because its inode number or timestamp is out of range. Regardless of whether you use this macro, portable programs should not assume that any of the types listed above fit into a ‘long int’. For example, it is not portable to print an arbitrary ‘off_t’ or ‘time_t’ value ‘X’ with ‘printf ("%ld", (long int) X)’. The standard C library functions ‘fseek’ and ‘ftell’ do not use ‘off_t’. If you need to use either of these functions, you should use ‘AC_FUNC_FSEEKO’ as well as ‘AC_SYS_LARGEFILE’, and then use their Posix replacements ‘fseeko’ and ‘ftello’. *Note AC_FUNC_FSEEKO::. When using ‘AC_SYS_LARGEFILE’ in different packages that are linked together and that have interfaces that depend on the width of ‘off_t’, ‘time_t’ or related types, the simplest thing is to configure all components the same way. For example, if an application uses ‘AC_SYS_LARGEFILE’ and is configured with ‘--enable-year2038’, libraries it links to with an ‘off_t’- or ‘time_t’-dependent interface should be configured equivalently. Alternatively, you can modify libraries to support both 32- and 64-bit interfaces though this is more work and few libraries other than the C library itself are modified in this way. Applications and libraries should be configured compatibly. If ‘off_t’, ‘time_t’ or related types appear in a library's public interface, enabling or disabling the library's large-file or year-2038 support may break binary compatibility with applications or with other libraries. Similarly, if an application links to a such a library, enabling or disabling the application's large-file support may break binary compatibility with that library. -- Macro: AC_SYS_LONG_FILE_NAMES If the system supports file names longer than 14 characters, define ‘HAVE_LONG_FILE_NAMES’. -- Macro: AC_SYS_POSIX_TERMIOS Check to see if the Posix termios headers and functions are available on the system. If so, set the shell variable ‘ac_cv_sys_posix_termios’ to ‘yes’. If not, set the variable to ‘no’. -- Macro: AC_SYS_YEAR2038 This is like ‘AC_SYS_LARGEFILE’ except it defaults to enabling instead of disabling year-2038 support. Year-2038 support for applications and libraries should be configured compatibly. *Note AC_SYS_LARGEFILE::. -- Macro: AC_SYS_YEAR2038_RECOMMENDED This macro has the same effect as ‘AC_SYS_YEAR2038’, but also declares that the program being configured should support timestamps after mid-January 2038. If a large ‘time_t’ is unavailable, ‘configure’ will error out unless the ‘--disable-year2038’ option is specified. Year-2038 support for applications and libraries should be configured compatibly. *Note AC_SYS_YEAR2038::.