@@ -352,6 +352,25 @@ AC_SUBST(SIZEOF_INT_P,$ac_cv_sizeof_int_p)
352352AC_CHECK_SIZEOF ( [ long] )
353353AC_SUBST ( SIZEOF_LONG ,$ac_cv_sizeof_long )
354354
355+ dnl Check for Homebrew packages
356+
357+ AC_CHECK_PROGS ( [ BREW] , [ brew] , [ false] )
358+
359+ dnl BREW_ADD_FLAG([FORMULA], [DIR], [FLAG], [PREFIX])
360+ dnl adds PREFIX$(brew --prefix FORMULA)/DIR (if it exists) to FLAG
361+ AC_DEFUN ( [ BREW_ADD_FLAG] ,
362+ [ AS_IF ( [ test "x$BREW" = xbrew -a -d $($BREW --prefix $1 )/$2 ] ,
363+ [ $3 ="$$3 $4 $($BREW --prefix $1 )/$2 "] ) ] )
364+
365+ dnl BREW_ADD_FLAGS([FORMULA])
366+ dnl adds -L$(brew --prefix FORMULA)/lib to LDFLAGS and
367+ dnl -I$(brew --prefix FORMULA)/include to CPPFLAGS
368+ AC_DEFUN ( [ BREW_ADD_FLAGS] ,
369+ [ BREW_ADD_FLAG([ $1 ] , [ lib] , [ LDFLAGS] , [ -L] )
370+ BREW_ADD_FLAG([ $1 ] , [ include] , [ CPPFLAGS] , [ -I] )] )
371+
372+ BREW_ADD_FLAGS
373+
355374AC_CHECK_HEADERS ( sys/ioctl.h termios.h sys/mman.h sys/socket.h netdb.h netinet/in.h arpa/inet.h sys/time.h time.h sys/wait.h sys/resource.h io.h linux/personality.h stddef.h elf.h execinfo.h syscall.h math.h pthread.h assert.h alloca.h malloc.h dlfcn.h )
356375AC_CHECK_HEADERS ( winsock2.h ) dnl used with ws2_32.dll under mingw64
357376dnl winsock2.h should be included before including windows.h
@@ -577,6 +596,7 @@ AC_COMPILE_IFELSE([AC_LANG_SOURCE([
577596dnl Check for openmp and fail if it cannot be found.
578597dnl This is required for building the library csdp and good for building the library normaliz
579598AC_LANG ( C++ )
599+ BREW_ADD_FLAGS([ libomp] ) # keg-only
580600AC_OPENMP
581601if test "$ac_cv_prog_cxx_openmp" = unsupported
582602 then AC_MSG_ERROR ( [ OpenMP does not work, use a compiler that supports OpenMP] )
12381258AC_LANG ( C )
12391259AC_SEARCH_LIBS ( tgoto ,curses tinfo ncurses ,,AC_MSG_ERROR ( [ [ not found: library containing symbol tgoto; tried libcurses, libncurses, and libtinfo)] ] ) )
12401260if test $BUILD_readline = no
1241- then AC_CHECK_HEADER ( readline/readline.h ,,BUILD_readline=yes )
1261+ then BREW_ADD_FLAGS([ readline] ) # keg-only
1262+ AC_CHECK_HEADER ( readline/readline.h ,,BUILD_readline=yes )
12421263fi
12431264if test $BUILD_readline = no
12441265then AC_SEARCH_LIBS ( rl_set_prompt ,readline ,,BUILD_readline=yes )
0 commit comments