An example to add an option to autoconf in EMAN Purpose Add openMP support for EMAN autoconf system, so that a user can compile openMP program optionally. Requirements: 1. default setup is no openMP. use option '--enable-openmp' to enable it. 2. openMP library and include directories can be specified with '--with-openmp-lib=DIR', and '--with-openmp-inc=DIR'. 3. 'omp.h' will be searched to determine whether openMP is installed on your computer. 4. '-lmp' is added to linker flags; '-mp' is added to compiler flags for SGI machines. 5. add openMP support to 'eman/src' binaries only Implementation Two files need to be edited. 1) EMAN/src/eman/configure.in; 2) EMAN/src/eman/src/Makefile.am 1. add the following to configure.in: AC_ARG_ENABLE(openmp, [ --enable-openmp enable OpenMP support [default=no]]) AC_ARG_WITH(openmp-includes, [ --with-openmp-inc=DIR OpenMP include files are in DIR]) AC_ARG_WITH(openmp-libraries,[ --with-openmp-lib=DIR OpenMP library files are in DIR]) if test "$enable_openmp" = "yes"; then search_headerdir "OpenMP" "omp.h" 0 $with_openmp_inc if test ! "X$found_incdir" = "X"; then OPENMP_CXXFLAGS="-DOPENMP -I${found_incdir}" if test ! $with_openmp_lib = "X"; then openmp_libdir="-L$with_openmp_lib" fi OPENMP_LIB="$openmp_libdir -lmp" else AC_MSG_RESULT([WARNING: OpenMP support disabled]) fi fi # for SGI machine only if test ! "$OPENMP_CXXFLAGS" = "X"; then OPENMP_CXXFLAGS="-mp ${OPENMP_CXXFLAGS}" fi AC_SUBST(OPENMP_CXXFLAGS) AC_SUBST(OPENMP_LIB) 2. add the following to src/Makefile.am 1) add '$(OPENMP_LIB)' to 'LDADD' macro 2) add '$(OPENMP_CXXFLAGS)' to 'AM_CXXFLAGS' macro