📄 configure.in
字号:
AC_PREREQ(2.59)AC_INIT(configure.in)dnldnl Set the directory that contains support scripts such as install-sh anddnl config.guessdnlAC_CONFIG_AUX_DIR(../../../../../confdb)dnl The MPICH2 top-level configure adds a bunch of flags to thednl user-defined CFLAGS by processing different configure command-linednl arguments (--enable-g, --enable-default-optimization). These updateddnl flags are passed down as a separate flag. Here, we don't care aboutdnl the user-defined flags, but rather this updated flags, so we justdnl overwrite CFLAGS with them.PAC_SUBCONFIG_INIT()dnldnl Definitions will be placed in this file rather than in the DEFS variablednlAC_CONFIG_HEADER(include/mpidi_ch3i_ssm_conf.h)AH_TOP([/* -*- Mode: C; c-basic-offset:4 ; -*- *//* * (C) 2001 by Argonne National Laboratory. * See COPYRIGHT in top-level directory. */#ifndef MPIDI_CH3I_SSM_CONF_H_INCLUDED#define MPIDI_CH3I_SSM_CONF_H_INCLUDED])AH_BOTTOM([#endif])echo "RUNNING CONFIGURE FOR THE SOCK-SHARED_MEMORY CHANNEL"save_libs=$LIBSLIBS=dnldnl First check that we have a clean build if we are doing a VPATH buildPAC_VPATH_CHECK()PAC_LOAD_BASE_CACHEAC_PROG_INSTALLPAC_PROG_CHECK_INSTALL_WORKS## On Mac OS/X, install breaks libraries unless used with the -p switchPAC_PROG_INSTALL_BREAKS_LIBS# We also need mkdir -p.PAC_PROG_MKDIR_PPAC_PROG_MAKEAC_CHECK_PROGS(AR,ar)if test -z "$AR" ; then AC_MSG_ERROR([The program ar is required for building MPICH2. Make sure that your path includes ar])fi# Note that we set RANLIB to true if we don't find it (some systems neither# need it nor provide it)AC_CHECK_PROGS(RANLIB,ranlib,true)dnl AC_DEFINE(USE_PROCESS_LOCKS,,[Define to use process locks])AC_DEFINE(USE_BUSY_LOCKS,,[Define to use busy locks])AC_ARG_ENABLE(mqshm,[--enable-mqshm - Disable this to use SysV message queues],,enable_mqshm=yes)if test $enable_mqshm = yes ; then AC_DEFINE(USE_MQSHM,,[Define to use shared memory message queues]) fiAC_CHECK_HEADERS(assert.h)dnl AC_CHECK_HEADERS(sys/types.h sys/socket.h net/if.h netinet/in.h sys/ioctl.h sys/sockio.h errno.h)## Note: if we plan to use the sys/ipc.h header, we need to assert that# we're using sysv or xopen varities of unix# To check for this, we compile sys/ipc.h (if present) and check for# a warning about _SVID_SOURCE or _XOPEN_SOURCE. If either is found,# we set _XOPEN_SOURCE now, before we do much additional testingAC_MSG_CHECKING([whether we need to define _XOPEN_SOURCE for sys/ipc.h])pac_cv_ipc_h_needs_xopen_source=norm -f conftest*echo "#include <sys/ipc.h>" > conftest.cif $CC -c $CFLAGS $CPPFLAGS conftest.c 2>conftest.er1 1>/dev/null ; then if test -s conftest.er1 && \ grep _XOPEN_SOURCE conftest.er1 >/dev/null 2>&1 ; then if $CC -c $CFLAGS $CPPFLAGS -D_XOPEN_SOURCE=500 conftest.c \ 2>conftest.er1 1>/dev/null ; then pac_cv_ipc_h_needs_xopen_source=yes fi fifiAC_MSG_RESULT($pac_cv_ipc_h_needs_xopen_source)if test "$pac_cv_ipc_h_needs_xopen_source" = yes ; then AC_DEFINE(_XOPEN_SOURCE,500,[Define to access sys/ipc.h cleanly])firm -f conftest*AC_SEARCH_LIBS(socket, socket)AC_CHECK_LIB(thread, mutex_init)AC_CHECK_HEADERS(pthread.h fcntl.h string.h strings.h sys/time.h sys/sem.h sys/ipc.h sys/msg.h sys/shm.h unistd.h sys/param.h sys/ioctl.h netinet/in.h netinet/tcp.h netdb.h sys/uio.h sys/select.h sys/types.h stdlib.h sys/socket.h sys/filio.h netinet/in.h values.h sys/uio.h sched.h arpa/inet.h sys/sockio.h net/if.h)AC_CHECK_HEADERS(sys/stat.h sys/ptrace.h sys/wait.h errno.h ctype.h process.h sys/mman.h uuid/uuid.h mqueue.h sys/sysctl.h)AC_CHECK_FUNCS(msgget yield mutex_init shmget shmat shmdt shmctl usleep sleep getcwd gethostname gettimeofday putenv select socket sched_yield)AC_CHECK_FUNCS(sysconf sysctl pthread_mutexattr_setpshared pthread_mutexattr_init)dnl AC_CHECK_FUNCS( mmap )# This autoconf code checks that mmap works, at least in # a simple case (private, fixed mapping of an already mapped memory)# It is a slightly better test than just checking that the function exists,# but is isn't fully adequate (we need something more complete)AC_FUNC_MMAPAC_SEARCH_LIBS( uuid_generate, uuid )AC_SEARCH_LIBS( mq_open, rt, AC_DEFINE(HAVE_MQ_OPEN,,[Define if mq_open is available]) )save_libs2=$LIBSAC_SEARCH_LIBS( shm_open, rt, have_shm_open=yes, have_shm_open=no)AC_SEARCH_LIBS( shm_unlink, rt, have_shm_unlink=yes, have_shm_unlink=no)if test $have_shm_open = "yes" -a $have_shm_unlink = "yes" ; then AC_MSG_CHECKING(that shm_open has been implemented) AC_TRY_RUN([#include <sys/types.h>#include <sys/mman.h>#include <fcntl.h>#include <errno.h>#include <unistd.h>int main(int argc, char ** argv){ int fd; fd = shm_open("/mpich2conf", O_RDWR | O_CREAT, 0666); if (fd == -1) { if (errno == ENOSYS) { return 1; } } else { shm_unlink("/mpich2conf"); close(fd); } return 0;}],shm_open_impl=yes,shm_open_impl=no,shm_open_impl=${CROSS_HAVE_SHM_OPEN:-no}) AC_MSG_RESULT($shm_open_impl) if test $shm_open_impl = "yes" ; then AC_DEFINE(HAVE_SHM_OPEN,,[Define if shm_open is available]) AC_DEFINE(HAVE_SHM_UNLINK,,[Define if shm_unlink is available]) else LIBS=$save_libs2 fielse LIBS=$save_libs2fiAC_CACHE_CHECK([whether SHM_R and SHM_W are defined],pac_cv_has_shm_rw,[AC_TRY_COMPILE([#include <sys/shm.h>],[ int flags = SHM_R | SHM_W; ],pac_cv_has_shm_rw=yes,pac_cv_has_shm_rw=no)])if test "$pac_cv_has_shm_rw" = yes ; then AC_DEFINE(HAVE_SHM_RW,1,[Define if SHM_R and SHM_W are available])fi# Add a test that shmget works (under cygwin, it causes the # program to immediately abort with "Bad system call".AC_CACHE_CHECK([whether shmget works],pac_cv_func_shmget_works,[AC_TRY_RUN([#include <sys/shm.h>int main(int argc, char *argv[]){ key_t key = rand(); int id = shmget(key,128,IPC_CREAT); if (id) shmctl(id,IPC_RMID,0); return (id > 0) ? 0 : 1;}],pac_cv_func_shmget_works=yes,pac_cv_func_shmget_works=no)])if test "$pac_cv_func_shmget_works" = "yes" ; then AC_DEFINE(HAVE_WORKING_SHMGET,1,[Define if shmget works])fidnl gcc checking AC_CACHE_CHECK([that linux86 cycle counter is available], pac_cv_linux86_cycle,[ AC_TRY_COMPILE(,[ long long var, *var_ptr=&var; __asm__ __volatile__("rdtscp; shl \$32, %%rdx; or %%rdx, %%rax" : "=a" (*var_ptr) : : "ecx", "rdx"); ],pac_cv_linux86_cycle=rdtscp, AC_TRY_COMPILE(,[ long long var, *var_ptr=&var; __asm__ __volatile__("push %%ebx ; cpuid ; rdtsc ; pop %%ebx" : "=A" (*var_ptr) : : "ecx"); ],pac_cv_linux86_cycle=cpuid_rdtsc, AC_TRY_COMPILE(,[[ long long var, *var_ptr=&var; __asm__ __volatile__("rdtsc" : "=A" (*var_ptr)); ]],pac_cv_linux86_cycle=rdtsc, pac_cv_linux86_cycle=no) ) ) ])case "$pac_cv_linux86_cycle" in "rdtscp") AC_DEFINE(GCC_X86_CYCLE_RDTSCP,1,[Define which x86 cycle counter to use]) ;; "cpuid_rdtsc") AC_DEFINE(GCC_X86_CYCLE_CPUID_RDTSC,1,[Define which x86 cycle counter to use]) ;; "rdtsc") AC_DEFINE(GCC_X86_CYCLE_RDTSC,1,[Define which x86 cycle counter to use]) ;; *) cpu_gcc_x86_cycle=no ;;esacif test "$cpu_gcc_x86_cycle" != "no" ; then AC_DEFINE_UNQUOTED(MPICH_CPU_TICK_TYPE, USE_GCC_X86_CYCLE_ASM, [Define if using gcc on an Intel CPU with the rdtsc instruction])dnl elsednl If a cycle counter is not available the code reverts to fixed spin waits. So no error is needed.dnl AC_MSG_ERROR([gcc x86 cycle counter is not available on this system])fi# Check for memory atomic instructionsPAC_C_MEMATOMICSSM_LIBS=$LIBSLIBS=$save_libs# We need the util/sock/ch3usock.h header fileCPPFLAGS="${CPPFLAGS} -I${master_top_srcdir}/src/mpid/ch3/util/sock"AC_SUBST(device_name)AC_SUBST(channel_name)AC_SUBST(SSM_LIBS)AC_SUBST(AR)AC_SUBST(RANLIB)AC_SUBST(MPILIBNAME)AC_SUBST(CC)AC_SUBST(CFLAGS)AC_SUBST(CPPFLAGS)PAC_CC_SUBDIR_SHLIBS# We need the script that is used to create shared libraries if either# we are creating shared libraries for MPICH2 or we are creating the# dynamically loadable library for the debugger interfaceif test -z "$CREATESHLIB" ; then if test ! -d ../../../../util ; then mkdir ../../../../util fi CREATESHLIB=`cd ../../../../util && pwd` CREATESHLIB="$CREATESHLIB/createshlib"fiAC_SUBST(CREATESHLIB)if test -z "$BUILD_DLLS" ; then BUILD_DLLS=nofiAC_SUBST(BUILD_DLLS)AC_SUBST(master_top_srcdir)AC_SUBST(master_top_builddir)dnldnl Dependency handlingAC_SUBST(MAKE_DEPEND_C)dnldnl EtagsAC_SUBST(ETAGS)AC_SUBST(ETAGSADD)export ETAGSexport ETAGSADDPAC_UPDATE_BASE_CACHE# Add the MPICH2 include flags to CPPFLAGS. See the discussion above about# which include flags should start in MPICH2_INCLUDE_FLAGS and which in # CPPFLAGSCPPFLAGS="$CPPFLAGS $MPICH2_INCLUDE_FLAGS"dnl Place holder macro for finalizationPAC_SUBCONFIG_FINALIZE()dnl Add a step to create the dependencies directory if it is not presentAC_OUTPUT_COMMANDS([if grep 'dependencies:' Makefile >/dev/null 2>&1 ; then if test ! -s src/.deps/alldeps ; then echo "Updating dependency directories .deps" find src -type d -print | sed -e 's%\(.*\)%(cd \1 \&\& grep MAKE_DEPEND_C Makefile >/dev/null 2>\&1 \&\& ( test -d .deps || mkdir .deps) \&\& touch .deps/alldeps)%g' | shfi; fi])AC_OUTPUT(Makefile src/Makefile localdefs)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -