dnl configure.in - Used to produce a configuration script for netboot dnl programs. Process this file with autoconf to create dnl a configure script. dnl dnl Copyright (C) 1996-2003 Gero Kuhlmann dnl dnl $Id: configure.ac,v 1.6 2003/03/09 00:43:09 gkminix Exp $ dnl dnl dnl =========================================================================== dnl dnl Include version information into M4 script. Note that this will only dnl define M4 macros which substitute to the netboot version. It does dnl not actually read the version file when the configure script is run. dnl All version information within the netboot package is derived from dnl these version macros. It is therefore necessary to re-build the configure dnl script every time the version information has changed. dnl m4_include(nbversion.m4) m4_if([NB_PATCHLEVEL], [0], [m4_define([NB_NBVERSION], [NB_VER_MAJOR.NB_VER_MINOR])], [m4_define([NB_NBVERSION], [NB_VER_MAJOR.NB_VER_MINOR.NB_PATCHLEVEL])]) m4_define([NB_COPYRIGHT], [1995-NB_YEAR G. Kuhlmann]) dnl dnl Now start the autoconfig game dnl AC_REVISION($Revision: 1.6 $) AC_INIT([netboot], [NB_NBVERSION], [netboot@gkminix.han.de]) AC_PREREQ(2.53) AC_CONFIG_SRCDIR(version) AC_CONFIG_AUX_DIR(misc) AC_COPYRIGHT([Copyright (C) NB_COPYRIGHT]) dnl dnl Define all the files which should be generated by this configure script dnl AC_CONFIG_HEADERS(include/config.h) AC_CONFIG_FILES(make.config include/version.h misc/romcheck/Makefile mknbi-mgl/Makefile bootrom/make.defs) dnl dnl If libdir or datadir are the same as the default, the user didn't dnl set them explicitly, so set our own default. dnl if test "$libdir" = '${exec_prefix}/lib'; then nblibdir='${exec_prefix}/lib/netboot' else nblibdir="$libdir" fi AC_SUBST(nblibdir) if test "$datadir" = '${prefix}/share'; then nbdatadir='${prefix}/share/netboot' else nbdatadir="$datadir" fi AC_SUBST(nbdatadir) dnl dnl Process any host information from the command line and determine on what dnl kind of CPU the utility programs are going to run. dnl AC_CANONICAL_HOST case "$host_cpu" in changequote(, )dnl i[3456]86) HOSTCPU=i386 ;; changequote([, ])dnl x86_64) HOSTCPU=i386 ;; *) HOSTCPU="$host_cpu" ;; esac dnl dnl Set a common name for the netboot configuration file dnl AC_ARG_ENABLE(config-file, [ --enable-config-file name of netboot config file (default=netboot.config)], [case "$enableval" in "yes" | "no" ) AC_MSG_ERROR(enable-config-file option must specify a file name) ;; "") CONFIGFILE="netboot.config" ;; *) CONFIGFILE="$enableval" ;; esac ], [CONFIGFILE="netboot.config"]) AC_SUBST(CONFIGFILE) dnl dnl Set version information dnl AC_SUBST([VER_MAJOR], '[NB_VER_MAJOR]') AC_SUBST([VER_MINOR], '[NB_VER_MINOR]') AC_SUBST([NBVERSION], '[NB_NBVERSION]') AC_SUBST([COPYRIGHT], '[NB_COPYRIGHT]') dnl dnl Check for subdirectories to build makefiles in dnl SUBDIRS="makerom" AC_ARG_ENABLE(bootrom, [ --enable-bootrom enable compiling the bootrom (default=disabled)], [if test "$enableval" = "yes"; then SUBDIRS="$SUBDIRS bootrom"; fi] ) AC_ARG_ENABLE(mknbi-dos, [ --disable-mknbi-dos disable compiling mknbi-dos (default=enabled)], [if test "$enableval" = "yes"; then SUBDIRS="$SUBDIRS mknbi-dos"; fi], [SUBDIRS="$SUBDIRS mknbi-dos"]) AC_ARG_ENABLE(mknbi-linux, [ --disable-mknbi-linux disable compiling mknbi-linux (default=enabled)], [if test "$enableval" = "yes"; then SUBDIRS="$SUBDIRS mknbi-linux"; fi], [SUBDIRS="$SUBDIRS mknbi-linux"]) AC_ARG_ENABLE(mknbi-mgl, [ --disable-mknbi-mgl disable compiling mknbi-mgl (default=enabled)], [if test "$enableval" = "yes"; then SUBDIRS="$SUBDIRS mknbi-mgl"; fi], [SUBDIRS="$SUBDIRS mknbi-mgl"]) AC_SUBST(SUBDIRS) dnl dnl =========================================================================== dnl dnl Check for C compiler and its options dnl tempflags="$CFLAGS" test "${CFLAGS+set}" = set || CFLAGS="-O" AC_PROG_CC if test -z "$tempflags"; then if test "$GCC" = yes; then CFLAGS="-O2" NB_CHECK_CC_ARG(Wall, [CFLAGS="${CFLAGS} -Wall"]) else CFLAGS="-O" fi fi AC_ISC_POSIX AC_C_PROTOTYPES AC_C_CONST AC_C_INLINE AC_C_VOLATILE dnl dnl We need to know some parameters of the system which is going to dnl execute the mknbi programs so cross-compiling is not possible dnl if test "$cross_compiling" = yes; then AC_MSG_ERROR([can't configure for cross compilation]) fi dnl dnl =========================================================================== dnl dnl check for programs required dnl ac_missing="$ac_abs_srcdir/misc/missing" AC_PROG_INSTALL AC_PROG_MAKE_SET AC_PROG_AWK AC_CHECK_PROGS(MD5SUM, md5sum, :) AC_PROG_CPP AC_PROG_RANLIB AC_CHECK_PROGS(AR, ar, :) AC_CHECK_PROGS(YACC, 'bison -y' byacc yacc, [$SHELL $ac_missing yacc]) AC_PROG_LEX if test "$LEX" != "flex"; then LEX="$SHELL $ac_missing flex" AC_SUBST(LEX_OUTPUT_ROOT, lex.yy) AC_SUBST(LEXLIB, '') fi dnl dnl =========================================================================== dnl dnl check for i386 GNU C compiler (either generic or cross-compiler) for dnl building 16-bit programs dnl AC_ARG_WITH(gnu-cc86, [ --with-gnu-cc86 specify path of i386 GNU C compiler], [if test -x "$withval"; then GCC86="$withval"; fi]) # determine if we have to look for an i386 C cross compiler case $HOSTCPU in i386) AC_MSG_CHECKING(for GNU C compiler) CCNAMES="gnu-cc:gcc:cc" CCPATH="$PATH" ;; *) AC_MSG_CHECKING(for i386 GNU C compiler) changequote(, )dnl CCNAMES="i[3456]86-*-cc:i[3456]86-*-gcc:gnu-cc:gcc:cc" CCPATH="/usr/i[3456]86-*/bin:/usr/local/i[3456]86-*/bin:$PATH" changequote([, ])dnl ;; esac # search for all files which look like a suitable compiler if test -z "$GCC86"; then CCFILES="" IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" for ac_dir in $CCPATH do if test -n "$ac_dir" -a -d "$ac_dir"; then changequote(, )dnl ac_files=`echo "$ac_dir/$CCNAMES" | \ sed -e "s;[:]; $ac_dir/;g"` changequote([, ])dnl for ac_prog in $ac_files do if test -x "$ac_prog"; then CCFILES="$CCFILES $ac_prog" fi done fi done IFS="$ac_save_ifs" else # the user is always right changequote(, )dnl CCFILES=`echo "$GCC86" | sed -e "s;[:]; ;g"` changequote([, ])dnl fi # check each file if it supports the i386 target GCC86="none" GCC86_AS="" GCC86_LD="" for ac_prog in $CCFILES do # check each compiler if it is GNU and supports a i386 target cc86_version_string="`$ac_prog --version 2>&1`" if (echo "$cc86_version_string" | egrep '(gcc|GCC)' >/dev/null); then # determine target and version of compiler changequote(, )dnl cc86_version=`$ac_prog -dumpversion 2>&1 | \ sed -e 's/^\([0-9]\+\)[.].*$/\1/;t;s/^.*$/0/'` cc86_target=`$ac_prog -dumpmachine 2>&1 | \ sed -e 's/^i[3456]86-.*$/i386/'` changequote([, ])dnl # we need at least version 3 and a i386 target if test "$cc86_version" -ge 3 -a \ "$cc86_target" = "i386" -a \ "$GCC86" = "none"; then # determine assembler and linker used by compiler changequote(, )dnl cc86_as=`$ac_prog -print-prog-name=as 2>&1 | \ sed -e ':begin;s/\/[^/]\+\/\.\.\//\//;t begin'` cc86_ld=`$ac_prog -print-prog-name=ld 2>&1 | \ sed -e ':begin;s/\/[^/]\+\/\.\.\//\//;t begin'` changequote([, ])dnl if test -x "$cc86_as" -a -x "$cc86_ld"; then GCC86="$ac_prog" GCC86_AS="$cc86_as" GCC86_LD="$cc86_ld" break fi fi fi done if test "${GCC86-none}" = "none"; then GCC86="none" CPP86="none" AC_MSG_RESULT(no) else CPP86="$GCC86 -E" AC_MSG_RESULT($GCC86) fi AC_SUBST(GCC86) AC_SUBST(CPP86) dnl dnl =========================================================================== dnl dnl check for i386 GNU assembler (either generic or cross-assembler) for dnl building 16-bit programs dnl AH_TEMPLATE(NEED_DATA32, [Define if GNU i386 assembler needs data32 prefix for movzx/movsx]) AC_ARG_WITH(gnu-as86, [ --with-gnu-as86 specify path of i386 GNU assembler], [if test -x "$withval"; then GAS86="$withval"; fi]) # determine if we have to look for an i386 cross assembler case $HOSTCPU in i386) AC_MSG_CHECKING(for GNU assembler) ASNAMES="gnu-as:gas:as" ASPATH="$PATH" ;; *) AC_MSG_CHECKING(for i386 GNU assembler) changequote(, )dnl ASNAMES="i[3456]86-*-as:i[3456]86-*-gas:gnu-as:gas:as" ASPATH="/usr/i[3456]86-*/bin:/usr/local/i[3456]86-*/bin:$PATH" changequote([, ])dnl ;; esac # search for all files which look like a suitable assembler if test -z "$GAS86"; then ASFILES="$GCC86_AS" IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" for ac_dir in $ASPATH do # search for suitable assemblers if test -n "$ac_dir" -a -d "$ac_dir"; then changequote(, )dnl ac_files=`echo "$ac_dir/$ASNAMES" | \ sed -e "s;[:]; $ac_dir/;g"` changequote([, ])dnl for ac_prog in $ac_files do if test -x "$ac_prog"; then ASFILES="$ASFILES $ac_prog" fi done fi done IFS="$ac_save_ifs" else # the user is always right changequote(, )dnl ASFILES=`echo "$GAS86" | sed -e "s;[:]; ;g"` changequote([, ])dnl fi # check each file if it supports the i386 target GAS86="none" GAS86TARGET="" GAS86EMUL="" for ac_prog in $ASFILES do # check each assembler if it is GNU and supports a i386 target as_version_string="`$ac_prog --version 2>&1`" if (echo "$as_version_string" | egrep '(GNU|with BFD)' >/dev/null); then # determine target of assembler changequote(, )dnl as_target=`echo "$as_version_string" | \ sed -ne '/target of/!d s/[ ][ ]*/ /g s/.*target of *\`// s/'\''.*$// s/i[3456]86/i386/ p'` changequote([, ])dnl # this list has been taken from GNU binutils source code # note: do NOT change the order of entries in here! case "$as_target" in i386-*-beospe*) as_target_obj="pei-i386" as_target_emul="i386beos" ;; i386-*-beos*) as_target_obj="elf32-i386" as_target_emul="elf_i386_be" ;; i386-*-winnt* | \ i386-*-pe | \ i386-*-cygwin* | \ i386-*-mingw32*) as_target_obj="pei-i386" as_target_emul="i386pe" ;; i386-*-interix*) as_target_obj="pei-i386" as_target_emul="i386pe_posix" ;; i386-*-bsd* | \ i386-*-freebsdaout* | \ i386-*-freebsd[12].* | \ i386-*-freebsd[12]) as_target_obj="a.out-i386-bsd" as_target_emul="i386bsd" ;; i386-*-netbsd* | \ i386-*-openbsd*) as_target_obj="a.out-i386-netbsd" as_target_emul="i386nbsd" ;; i386-*-freebsd* | \ i386-*-linux-gnu* | \ i386-*-sysv[45]* | \ i386-*-solaris*) as_target_obj="elf32-i386" as_target_emul="elf_i386" ;; i386-*-linux*aout* | \ i386-*-linux*oldld) as_target_obj="a.out-i386-linux" as_target_emul="i386linux" ;; i386-*-lynxos*) as_target_obj="coff-i386-lynx" as_target_emul="i386lynx" ;; i386-*-aix* | \ i386-*-linux*coff* | \ i386-*-sysv* | \ i386-*-sco3.2* | \ i386-*-isc*) as_target_obj="coff-i386" as_target_emul="i386coff" ;; i386-*-rtemself* | \ i386-*-linux | \ i386-*-elf* | \ i386-*-gnu*) as_target_obj="elf32-i386" as_target_emul="elf_i386" ;; i386-*-msdosdjgpp* | \ i386-*-go32* | \ i386-go32-rtems*) as_target_obj="coff-go32" as_target_emul="i386go32" ;; i386-*-rtems* | \ i386-*-coff) as_target_obj="coff-i386" as_target_emul="i386coff" ;; i386-*-msdos) as_target_obj="a.out-i386" as_target_emul="i386msdos" ;; i386-*-mach*) as_target_obj="a.out-mach3" as_target_emul="i386mach" ;; i386-*-moss*) as_target_obj="elf32-i386" as_target_emul="i386moss" ;; i386-*-vxworks* | \ i386-*-aout) as_target_obj="a.out-i386" as_target_emul="i386aout" ;; i386-*-chaos) as_target_obj="elf32-i386" as_target_emul="elf_i386_chaos" ;; *) as_target_obj="" as_target_emul="" ;; esac if test -n "$as_target_obj" -a -n "$as_target_emul"; then NB_CHECK_COMP([$ac_prog -o conftest.o], [ .intel_syntax noprefix .arch i386 .code16 .text _start: mov ax,0 mov es,ax mov ebx,dword [dat1] mov si,offset dat1 ret .data dat1: .long 0x123 ], [ if test "$GAS86" = "none"; then GAS86="$ac_prog" GAS86TARGET="$as_target_obj" GAS86EMUL="$as_target_emul" else # prefer elf over a.out over coff # over pei case "$GAS86TARGET/$as_target_obj" in a.out-*/elf32-* | \ coff-*/elf32-* | \ pei-*/elf32-* | \ coff-*/a.out-* | \ pei-*/a.out-* | \ pei-*/coff-*) GAS86="$ac_prog" GAS86TARGET="$as_target_obj" GAS86EMUL="$as_target_emul" ;; esac fi ]) fi fi done if test "${GAS86-none}" = "none" ; then GAS86="none" AC_MSG_RESULT(no) else # Some versions of GAS have problems with movzx/movsx as they # need a data32 prefix NB_CHECK_COMP([$GAS86 -o conftest.o], [ .intel_syntax noprefix .arch i386 .code16 .text _start: mov ax,0 data32 movzx ebx,ax ret ], [ AC_DEFINE(NEED_DATA32) ]) AC_MSG_RESULT($GAS86) fi AC_SUBST(GAS86) dnl dnl =========================================================================== dnl dnl check for i386 GNU linker to produce 16-bit i386 programs dnl AC_ARG_WITH(gnu-ld86, [ --with-gnu-ld86 specify path of i386 GNU linker], [if test -x "$withval"; then GLD86="$withval"; fi]) # determine if we have to look for an i386 cross linker case $HOSTCPU in i386) AC_MSG_CHECKING(for GNU linker) LDNAMES="gnu-ld:gld:ld" LDPATH="$PATH" ;; *) AC_MSG_CHECKING(for GNU linker supporting i386) changequote(, )dnl LDNAMES="i[3456]86-*-ld:i[3456]86-*-gld:gnu-ld:gld:ld" LDPATH="/usr/i[3456]86-*/bin:/usr/local/i[3456]86-*/bin:$PATH" changequote([, ])dnl ;; esac # search for all files which look like a suitable linker if test -z "$GLD86"; then LDFILES="$GCC86_LD" IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" for ac_dir in $LDPATH do # search for suitable linkers if test -n "$ac_dir" -a -d "$ac_dir"; then changequote(, )dnl ac_files=`echo "$ac_dir/$LDNAMES" | \ sed -e "s;[:]; $ac_dir/;g"` changequote([, ])dnl for ac_prog in $ac_files do if test -x "$ac_prog"; then LDFILES="$LDFILES $ac_prog" fi done fi done IFS="$ac_save_ifs" else # the user is always right changequote(, )dnl LDFILES=`echo "$GLD86" | sed -e "s;[:]; ;g"` changequote([, ])dnl fi # check each file if it supports the i386 target GLD86="none" FIRST_EMUL="" for ac_prog in $LDFILES do # check each linker if it is GNU and supports a i386 target ld_version_string="`$ac_prog -v 2>&1`" if (echo "$ld_version_string" | egrep '(GNU|with BFD)' >/dev/null); then # determine linker emulations and targets ld_help_string="`$ac_prog --help 2>&1`" changequote(, )dnl ld_emul=`echo "$ld_help_string" | \ sed -ne '/supported emulations:/!d s/[ ][ ]*/ /g s/.*supported emulations: *// p'` ld_targets=`echo "$ld_help_string" | \ sed -ne '/supported targets:/!d s/[ ][ ]*/ /g s/.*supported targets: *// p'` changequote([, ])dnl # check that linker supports emulation required for assembler ld_has_emul="no" for i in $ld_emul do if test -z "$FIRST_EMUL"; then FIRST_EMUL="$i" fi if test "$i" = "$GAS86EMUL"; then ld_has_emul="yes" break fi done # check that linker supports input and output targets ld_has_binary_target="no" ld_has_input_target="no" for i in $ld_targets do if test "$i" = "$GAS86TARGET"; then ld_has_input_target="yes" fi if test "$i" = "binary"; then ld_has_binary_target="yes" fi done if test "$ld_has_emul" = "yes" -a \ "$ld_has_binary_target" = "yes" -a \ "$ld_has_input_target" = "yes"; then GLD86="$ac_prog" break fi fi done if test "${GLD86-none}" = "none" ; then GLD86="none" GLD86_TARGET_FLAGS="" AC_MSG_RESULT(no) else if test "$FIRST_EMUL" = "$GAS86EMUL"; then # native linker GLD86_TARGET_FLAGS="" else # cross linker GLD86_TARGET_FLAGS="-m $GAS86EMUL -b $GAS86TARGET" fi AC_MSG_RESULT($GLD86) fi AC_SUBST(GLD86) AC_SUBST(GLD86_TARGET_FLAGS) dnl dnl =========================================================================== dnl dnl check for some other GNU programs required for building 16 bit programs dnl also check if we have to recreate the target system library dnl AC_PATH_PROG(GASP, gasp, [none]) if test "$GCC86" = "none" -o ! -x "$GCC86" -o \ "$GAS86" = "none" -o ! -x "$GAS86" -o \ "$GLD86" = "none" -o ! -x "$GLD86" -o \ "$GASP" = "none" -o ! -x "$GASP"; then GNU16BIT="nognu" AC_MSG_WARN([Can't compile i86 modules, using default]) else GNU16BIT="gnu" fi if test "$GNU16BIT" = "gnu"; then SUBDIRS="i386 $SUBDIRS" fi AC_SUBST(GNU16BIT) dnl dnl =========================================================================== dnl dnl check for optimizing command line switches dnl OPTIMIZE="" AC_ARG_ENABLE(optimize, [ --disable-optimize disable peephole optimizer for bootrom (default=enabled)], [if test "$enableval" = "yes"; then OPTIMIZE="OPTIMIZE=-DOPTIMIZE"; fi], [OPTIMIZE="OPTIMIZE=-DOPTIMIZE"]) AC_SUBST(OPTIMIZE) dnl dnl =========================================================================== dnl dnl check for some special programs required for 16 bit programs dnl AC_ARG_WITH(dev86, [ --without-dev86 dont use any Dev86 programs], [DEV86PATH="$withval"], [DEV86PATH="yes"]) if test "$DEV86PATH" != "yes" -a "$DEV86PATH" != "no"; then testpath="$DEV86PATH:$PATH" else testpath="/usr/local/bcc/bin:/usr/local/bcc/lib/bcc:/usr/bcc/bin:/usr/bcc/lib/bcc:/usr/lib/bcc:$PATH" fi DEV86="no86" if test "$DEV86PATH" != "no"; then AC_PATH_PROG(AS86, as86, , [$testpath]) else AS86="" fi if test -n "$AS86"; then AC_MSG_CHECKING(for correct version of $AS86) NB_CHECK_COMP($AS86, [ macro testm mov ax,?1 mend .text start: testm(0) ifc(si,si) mov ax,#0 endif ], [ AC_MSG_RESULT(yes) AC_PATH_PROG(LD86, [ld86 -d -i], , [$testpath]) if test -n "$LD86"; then AC_PATH_PROG(BCC, bcc, , [$testpath]) if test -n "$BCC"; then AC_MSG_CHECKING(for correct version of $BCC) NB_CHECK_COMP([$BCC -0 -S], [ main() { int i; i = 1; } ], [ AC_MSG_RESULT(yes) AC_PATH_PROG(COPT, copt, , [$testpath]) if test -n "$COPT"; then DEV86="i86" fi ], [ AC_MSG_RESULT(no) ]) fi fi ], [ AC_MSG_RESULT(no) ]) fi if test "$DEV86" = "no86"; then AC_MSG_WARN([Can't compile bootrom, using default]) fi AC_SUBST(DEV86) dnl dnl =========================================================================== dnl dnl check for header files dnl AC_STDC_HEADERS AC_HAVE_HEADERS(string.h memory.h unistd.h getopt.h malloc.h netdb.h assert.h \ limits.h netinet/in.h sys/time.h sys/param.h sys/bitypes.h arpa/inet.h) AC_HEADER_DIRENT dnl dnl =========================================================================== dnl dnl check for structures and types dnl AC_TIME_WITH_SYS_TIME AC_STRUCT_TM AC_SIZE_T dnl dnl =========================================================================== dnl dnl check for misc. library functions dnl AC_CHECK_FUNCS([memcpy memmove strchr strrchr strstr strspn strcspn getopt_long]) AC_CHECK_FUNCS([mkstemp tempnam], [break]) dnl dnl =========================================================================== dnl dnl check for network support routines dnl if test "$ISC" = yes; then LIBS="$LIBS -lnsl_s -linet" else AC_CHECK_FUNC(gethostbyname) if test $ac_cv_func_gethostbyname = no; then AC_CHECK_LIB(nsl, gethostbyname, LIBS="$LIBS -lnsl") fi AC_CHECK_FUNC(inet_ntoa) if test $ac_cv_func_inet_ntoa = no; then AC_CHECK_LIB(socket, inet_ntoa, LIBS="-lsocket $LIBS") fi AC_CHECK_FUNC(inet_addr) if test $ac_cv_func_inet_addr = no; then AC_CHECK_LIB(socket, inet_addr, LIBS="-lsocket $LIBS") fi fi AC_SUBST(LIBS) dnl dnl =========================================================================== dnl dnl check for compiler characteristics dnl AH_TEMPLATE(USE_PACKED, [Define if compiler supports __attribute__((packed))]) AH_TEMPLATE(USE_PRAGMA_PACK, [Define if compiler supports pragma pack(1)]) AH_TEMPLATE(USE_PRAGMA_ALIGN, [Define if compiler supports pragma options align=packed]) AC_CACHE_CHECK(for packed attribute, ac_cv_use_packed, [ ac_cv_use_packed=no AC_TRY_COMPILE(, [ struct test_struct { int i1 __attribute__((packed)); } t1; ], ac_cv_use_packed=yes) ]) if test "$ac_cv_use_packed" = yes; then AC_DEFINE(USE_PACKED) else AC_CACHE_CHECK(for pack pragma, ac_cv_use_pragma_pack, [ ac_cv_use_pragma_pack=no AC_TRY_RUN([ #pragma pack(1) struct { char c[3]; int i; } s; #pragma pack() main() { char *cp1, *cp2; cp1 = (char *)(&s.i); cp2 = (char *)(&s) + 3; exit(cp1 != cp2); } ], ac_cv_use_pragma_pack=yes, ac_cv_use_pragma_pack=no, ac_cv_use_pragma_pack=no) ]) if test "$ac_cv_use_pragma_pack" = yes; then AC_DEFINE(USE_PRAGMA_PACK) else AC_CACHE_CHECK(for align pragma, ac_cv_use_pragma_align, [ ac_cv_use_pragma_align=no AC_TRY_RUN([ #pragma options align=packed struct { char c[3]; int i; } s; #pragma options align=reset main() { char *cp1, *cp2; cp1 = (char *)(&s.i); cp2 = (char *)(&s) + 3; exit(cp1 != cp2); } ], ac_cv_use_pragma_align=yes, ac_cv_use_pragma_align=no, ac_cv_use_pragma_align=no) ]) if test "$ac_cv_use_pragma_align" = yes; then AC_DEFINE(USE_PRAGMA_ALIGN) else AC_MSG_WARN([Can't find out how to pack structures, programs might not run properly]) AC_DEFINE(USE_PRAGMA_PACK) fi fi fi AH_TEMPLATE(USE_U_INT, [Define if system has u_int8_t, u_int16_t and u_int32_t defined]) AH_TEMPLATE(USE__UXX, [Define if system has __u8, __u16 and __u32 defined]) AH_TEMPLATE(U8_TYPE, [Set to the type your C compiler uses for 8 bit variables, for example 'unsigned char'. If defined, this will override the type definitiones found in standard header files.]) AH_TEMPLATE(U16_TYPE, [Set to the type your C compiler uses for 16 bit variables, for example 'unsigned short'. If defined, this will override the type definitiones found in standard header files.]) AH_TEMPLATE(U32_TYPE, [Set to the type your C compiler uses for 32 bit variables, for example 'unsigned long'. If defined, this will override the type definitiones found in standard header files.]) AC_CACHE_CHECK(for definition of __uxx in types.h, ac_cv_use__uxx, [ ac_cv_use__uxx=no AC_TRY_COMPILE([ #include #ifdef HAVE_SYS_BITYPES_H #include #endif], [__u8 u1; __u16 u2; __u32 u3;], ac_cv_use__uxx=yes) ]) if test "$ac_cv_use__uxx" = yes; then AC_DEFINE(USE__UXX) else AC_CACHE_CHECK(for definition of u_intxx_t in types.h, ac_cv_use_u_int, [ ac_cv_use_u_int=no AC_TRY_COMPILE([ #include #include #ifdef HAVE_SYS_BITYPES_H #include #endif], [u_int8_t u1; u_int16_t u2; u_int32_t u3;], ac_cv_use_u_int=yes) ]) if test "$ac_cv_use_u_int" = yes; then AC_DEFINE(USE_U_INT) fi fi AC_SIZEOF_TYPE(unsigned char, csize) AC_SIZEOF_TYPE(unsigned short, ssize) AC_SIZEOF_TYPE(unsigned long, lsize) AC_SIZEOF_TYPE(unsigned int, isize) dnl dnl =========================================================================== dnl dnl check for system characteristics dnl AH_TEMPLATE(USE_COPY, [Define if system cannot access misaligned data and has to use memcpy]) AC_CACHE_CHECK(whether system allows accessing misaligned data, ac_cv_allow_misalign, [ AC_TRY_RUN([ #ifdef USE_PACKED #define PACKED __attribute__((packed)) #else #define PACKED #endif #ifdef USE_PRAGMA_PACK #pragma pack(1) #endif #ifdef USE_PRAGMA_ALIGN #pragma options align=packed #endif struct { int a PACKED; char c[3] PACKED; int i PACKED; } s; #ifdef USE_PRAGMA_PACK #pragma pack() #endif #ifdef USE_PRAGMA_ALIGN #pragma options align=reset #endif main() { s.i = 1; exit(s.i != 1); } ], ac_cv_allow_misalign=yes, ac_cv_allow_misalign=no, ac_cv_allow_misalign=no) ]) if test "$ac_cv_allow_misalign" = no; then AC_DEFINE(USE_COPY) fi AC_C_BIGENDIAN dnl dnl =========================================================================== dnl dnl now generate everything dnl AC_OUTPUT